我正在尝试按顺序执行多个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);
这个文件被调用,然后这两个请求应该一个接一个地执行,但是现在它只是不起作用。
提前Thanx!