Facebook PHP SDK卷曲代理

时间:2010-10-15 13:23:58

标签: php facebook curl

我试图设置php sdk。 SDK使用Curl发出请求。但我必须通过代理来做这件事。

我的选择:

  public static $CURL_OPTS = array(
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 60,
    CURLOPT_USERAGENT      => 'facebook-php-2.0',
    CURLOPT_PROXYPORT      => '8080',
    CURLOPT_PROXY          => 'proxy',

  );

curl_setopt_array($ch, $opts);
print "<pre>"; print_r($opts);    print "</pre>";

这是打印:

Array
(
    [78] => 10
    [19913] => 1
    [13] => 60
    [10018] => facebook-php-2.0
    [59] => 8080
    [10004] => proxy
    [10015] => method=GET&access_token=xxxxxxxxxxxxxxxxxx
    [10002] => https://graph.facebook.com/naitik
    [10023] => Array
        (
            [0] => Expect:
        )

)

并打印print_r(curl_error($ ch));回来:

Received HTTP code 403 from proxy after CONNECT

应该使用哪些选项来实现它?

1 个答案:

答案 0 :(得分:1)

如果CURLE_SSL_CACERT出现问题,请输入以下行:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

已添加到

if (curl_errno($ch) == 60) {
.
.

应该解决问题。