无法使用PHP发布到graph.facebook.com(即使我可以在浏览器中打开它)

时间:2014-11-20 08:03:58

标签: php facebook facebook-graph-api post

我正在使用Facebook Graph api将图片发布到Facebook页面,它一直工作到昨天,但现在我得到了#34;网络无法访问"使用PHP时,我可以在我的浏览器中打开它,它会加载并显示响应。

我想:

发布到https://graph.facebook.com/v2.2/828075613886272/photos

发布内容:access_token=x

我实际上并不需要回复!

我试过了:

  $ret = $fb->api('/828075613886272/photos', 'POST', $params)

错误:Failed to connect to 2a03:2880:2130:cf05:face:b00c:0:1: Network is unreachable)


NEXT:

Failed to connect to 2a03:2880:2130:cf05:face:b00c:0:1: Network is unreachable)

ERROR:

Warning: stream_context_create() [function.stream-context-create]: options should have the form ["wrappername"]["optionname"] = $value in /srv/disk12/1737892/www/x/test.php on line 94

Warning: stream_context_create() [function.stream-context-create]: options should have the form ["wrappername"]["optionname"] = $value in /srv/disk12/1737892/www/x/test.php on line 94

Warning: stream_context_create() [function.stream-context-create]: options should have the form ["wrappername"]["optionname"] = $value in /srv/disk12/1737892/www/x/test.php on line 94

Warning: fopen(https://graph.facebook.com/v2.2/828075613886272/photos) [function.fopen]: failed to open stream: Network is unreachable in /srv/disk12/1737892/www/x/test.php on line 96

NEXT:

file_get_contents (
         'http://graph.facebook.com/v2.2/828075613886272/photos',  // page url
         false,
         $context);

错误:

Warning: stream_context_create() [function.stream-context-create]: options should have the form ["wrappername"]["optionname"] = $value in /srv/disk12/1737892/www/x/test.php on line 94

Warning: stream_context_create() [function.stream-context-create]: options should have the form ["wrappername"]["optionname"] = $value in /srv/disk12/1737892/www/x/test.php on line 94

Warning: stream_context_create() [function.stream-context-create]: options should have the form ["wrappername"]["optionname"] = $value in /srv/disk12/1737892/www/x/test.php on line 94

Warning: file_get_contents(https://graph.facebook.com/v2.2/828075613886272/photos) [function.file-get-contents]: failed to open stream: Network is unreachable in /srv/disk12/1737892/www/xtest.php on line 102

我在上面添加了所有代码:

$params = array(
      "access_token" => "x"

    );

$query = http_build_query ($params);

// Create Http context details
$contextData = array (
            'method' => 'POST',
            'header' => "Connection: close\r\n".
                        "Content-Length: ".strlen($query)."\r\n",
            'content'=> $query );

// Create context resource for our request
$context = stream_context_create($contextData);

注意:我没有SSL

0 个答案:

没有答案