Fatal error: Uncaught CurlException: 26: failed cr

2019-07-20 13:55发布

I get the following error:

Fatal error: Uncaught CurlException: 26: failed creating formpost data thrown in /home/u801961841/public_html/inc/lib/base_facebook.php on line 814

This is the code I used:

    if ($result === false) {
      $e = new FacebookApiException(array(
        'error_code' => curl_errno($ch),
        'error' => array(
        'message' => curl_error($ch),
        'type' => 'CurlException',
        ),
      ));
      curl_close($ch);
      throw $e;
    }
    curl_close($ch);
    return $result;
  }

Does anyone know how to solve this problem?

3条回答
时光不老,我们不散
2楼-- · 2019-07-20 14:18

The path to the image is not correct. Correct it and the problem will be solved.

查看更多
Deceive 欺骗
3楼-- · 2019-07-20 14:23

If you are uploading the file using $_FILE, You need to use the "realpath($_FILE)". But if you are using local image file from your server, you need to use the dirname() to correctly point to the image.

dirname(dirname(dirname(FILE))).'/plugins/fun/images/'.$image_name;

查看更多
虎瘦雄心在
4楼-- · 2019-07-20 14:36

I presume that you are trying a file upload to Facebook, such as a photo upload. Something that involves reading a file and building into the call.

If not, then amend the question. (Your link for the source doesn't work for me - so put the relevent bits in the question.)

If so, then this error is because PHP cannot read the file that you are trying to upload. Check the file exists, check your permissions for the file, and that PHP/Apache user has rights to read it. You can do this with file_exists() and is_readable() before you build the facebook call.

查看更多
登录 后发表回答