2010-10-15 108 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) { 
. 
. 

應該解決的問題。