Je suis en train de séquentiellement exécuter des demandes curl multiples, mais je ne suis pas vraiment avoir une chance, voici mon code jusqu'ici,exécution de multiples demandes cURL
//upload photo
$file= 'photo.jpg';
$args = array(
'message' => 'Photo from application',
);
$args[basename($file)] = '@' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/me/photos?access_token='.$token;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
$args_two = array(
'message' => 'This is a test post',
);
$ch_two = curl_init();
$url_two = 'https://graph.facebook.com/me/feed?access_token='.$token;
curl_setopt($ch_two, CURLOPT_URL, $url_two);
curl_setopt($ch_two, CURLOPT_HEADER, false);
curl_setopt($ch_two, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch_two, CURLOPT_POST, true);
curl_setopt($ch_two, CURLOPT_POSTFIELDS, $args_two);
$data_two = curl_exec($ch_two);
Ce fichier est appelé, puis les deux demandes doivent être exécuté l'un après l'autre, mais en ce moment, il ne fonctionne tout simplement pas.
Merci d'avance!
Je suggère que vous utilisez facebooks php sdk http: //github.com/facebook/php-sdk/ – Codler
Je l'ai obtenu pour télécharger individuellement avec le code ci-dessus, mais dès que je mets tout dans un fichier, il se brise, donc je dois trouver la bonne façon d'exécuter demandes multiples curl. – Odyss3us