0

我有一个使用旧 Facebook API 的应用程序,但现在我正在迁移它。在我尝试上传照片之前,该应用程序运行良好。

我知道如何以旧的方式做到这一点,但现在......我遇到了麻烦。

这是我以前的做法:

$args = array ( 'method' => 'photos.upload', 'v' => $ver, 'api_key' => $key, 'uid' => $uid, 'call_id' => $cid, 'format ' => 'XML', '标题' => $caption );

signRequest($args, $sec);
$args[basename($file)] = '@' . realpath($file);

$ch = curl_init();
$url = 'http://api.facebook.com/restserver.php?method=photos.upload';
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);

有任何想法吗??

谢谢

4

2 回答 2

0

API url 以https://not开头http://。这可能是问题所在。

于 2010-06-28T18:31:48.977 回答
0

我在这里找到了解决方案:

将图片上传到 Facebook

展示了如何将新的 Facebook Graph API 与 PHP Curl 函数和有效的会话令牌一起使用。

于 2010-06-28T22:47:07.590 回答