w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Facebook API posting photos/status updates very slow

Since you're sending the same tweet for the whole list, you can definitely get some improvement from doing this:

$tweet = GetContentsUsingCurl($TWEET_URL, "");
$message = $tweet.$TEXT_MESSAGE.$AD;
/// loop code
  PostPhoto($fbId, $access_token);
  PostText($fbId, $access_token, $message);

And then change your PostText function to:

function PostText($fbId, $access_token, $message)
    $url = 'https://graph.facebook.com/' . $fbId . '/feed';
    $attachment =  array(
            'access_token'  => $access_token,
            'message'  => $message

    $result = GetContentsUsingCurl($url, $attachment);
    $result = json_decode($result, TRUE);
    if( isset($result['error']) ) 
        echo "Error Message: ".$result['error']['message']."<br/>";
        echo "Error Type: ".$result['error']['type']."<br/>";
        echo "Error Code: ".$result['error']['code']."<br/>";
        echo "<pre>";
        echo "Feed posted successfully!<br/>";

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.