i made wordpress website in 2012 and since then i am using facebook graph api(php sdk) tool to upload pictures to users fb profile, now i dont know why its saying facebook redirected you too many times
here is the example link of picture where you can see upload to fb option
http://www.punjabidharti.com/punjabi/punjabi-sad/roula-kaavan-da/
This is my code in fb index file
<?php
if(isset($_POST["source"]))
{
try {
$access_token=$facebook->getAccessToken();
$graph_url= "https://graph.facebook.com/me/photos?"
. "url=" . urlencode($_POST["source"])
. "&message=" . urlencode($_POST['message'])
. "&method=POST"
. "&access_token=" .$access_token;
$response=file_get_contents($graph_url);
$json=json_decode($response);
}
catch (FacebookApiException $e) {
error_log('Could not post image to Facebook.');
}
}
?>
i am using api 2.0 and in base_facbook file
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.1',
);
please help me