Posting photo via Facebook graph no longer working

I'm trying to post a photo using the php-sdk - all was working for months successfully but all of the sudden no dice.

Other functions are still working with the same code base (ie: posting messages to wall) - its just the posting of photos that broke on my side.

try {
        $data = $facebook->api('/me/photos', 'post', $args);
      } catch (FacebookApiException $e) {
print_r($e);}

Is dumping:

FacebookApiException Object ( [result:protected] => Array ( [error_code] => 3 [error] => Array ( [message] => No URL set! [type] => CurlException ) ) [message:protected] => No URL set! [string:private] => [code:protected] => 3 [file:protected] => /locationofmy/base_facebook.php [line:protected] => 818 [trace:private] => Array ( [0] => Array [..............]

From the FB php-sdk lines 818:

    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;
  }

This was working for a long time - has something changed on Facebooks side?

EDIT: php-sdk version: 3.1.1

EDIT 2:

$tag = array(
                'tag_uid' => 'acct_num',
                'x' => 0,
                'y' => 0
            );

        $tags[] = $tag;

        $args = array(
            'message' => $item_description,
            'image'   => '@' . realpath($temp_path . $tempFile),
            'tags'    => $tags,
            );

Answers


Probably that the file doesnt exist, or the file system can't serve it anymore. Can you confirm "$temp_path . $tempFile" - the error is no URL, usually that means no real path to image. I suspect, that the images are missing and/or your servers filled up and no local images are saving. (Yes, this has happened to me before!)


Try changing the image to source. I believe this should fix your issue.

The Facebook API requires a source field but I did not see anything about an image field.

You may also have to pass the actual file contents instead of the real_path (based on the example). Or, alternatively, pass an external URL (based on my understanding of the documentation).

Source: https://developers.facebook.com/docs/reference/api/photo/

Example: https://developers.facebook.com/blog/post/498/


Need Your Help

Android studio: INSTALL_FAILED_CONFLICTING_PROVIDER facebook sdk

android facebook android-studio android-manifest android-facebook

I'm facing a strange problem with android studio. I have two Android app that uses facebook sdk with same facebook Application for login and share pictures. With new api, it's necessary to declare ...

Please help me understand this piece of code in Java

java

'm having issues understanding what exactly this piece of code does: