2010-10-15 119 views
0

我试图设置php sdk。 SDK正在使用Curl发出请求。但我必须通过代理来做到这一点。Facebook PHP SDK通过代理卷曲

我OPTS:

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 

应该使用什么opptions,让它工作?

回答

1

在情况下,它是与CURLE_SSL_CACERT,这条线的一个问题:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

加入

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

应该解决的问题。