2013-01-21 76 views
0

我有一些代碼:與tmhOAuth庫Twitter的OAuth的錯誤

<?php 

require '../tmhOAuth.php'; 
require '../tmhUtilities.php'; 

$tmhOAuth = new tmhOAuth(array(
    'consumer_key' => 'THE_CONSUMER_KEY', 
    'consumer_secret' => 'THE_CONSUMER_SECRET', 
    'user_token' => 'THE_ACCESS_TOKEN', 
    'user_secret' => 'THE_ACCESS_TOKEN_SECRET', 
)); 

$response = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/update'), array(
    'status' => 'Test message. Lorem ipsum.' 
)); 

if ($response != 200) { 
    //Do something if the request was unsuccessful 
    echo 'There was an error posting the message.<pre>'; 
    print_r($tmhOAuth); 
    echo '</pre>'; 
} 
?> 

而且結果:

There was an error posting the message. 
tmhOAuth Object 
(
    [response] => Array 
     (
      [raw] => HTTP/1.0 200 Connection established 


      [headers] => Array 
       (
        [HTTP/1.0 200 Connection established] => 
        [] => 
       ) 

      [code] => 0 
      [response] => 
      [info] => Array 
       (
        [url] => https://api.twitter.com/1.1/statuses/update.json 
        [content_type] => 
        [http_code] => 0 
        [header_size] => 0 
        [request_size] => 444 
        [filetime] => -1 
        [ssl_verify_result] => 0 
        [redirect_count] => 0 
        [total_time] => 2.279306 
        [namelookup_time] => 7.3E-5 
        [connect_time] => 0.001006 
        [pretransfer_time] => 0 
        [size_upload] => 0 
        [size_download] => 0 
        [speed_download] => 0 
        [speed_upload] => 0 
        [download_content_length] => -1 
        [upload_content_length] => -1 
        [starttransfer_time] => 0 
        [redirect_time] => 0 
        [certinfo] => Array 
         (
         ) 

        [primary_ip] => 172.30.10.17 
        [primary_port] => 3128 
        [local_ip] => 172.30.37.89 
        [local_port] => 59260 
        [redirect_url] => 
        [request_header] => CONNECT api.twitter.com:443 HTTP/1.1 
Host: api.twitter.com:443 
User-Agent: tmhOAuth 0.7.2+SSL - //github.com/themattharris/tmhOAuth 
Proxy-Connection: Keep-Alive 
Authorization: OAuth oauth_consumer_key="THE_CONSUMER_KEY", oauth_nonce="123123", oauth_signature="123123", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1358771273", oauth_token="THE_ACCESS_TOKEN", oauth_version="1.0" 


       ) 

      [error] => error setting certificate verify locations: 
         CAfile: /home/my/www/test/cacert.pem 
         CApath: /home/my/www/test 
      [errno] => 77 
     ) 

我不知道如何解決它:

 [error] => error setting certificate verify locations: 
        CAfile: /home/my/www/test/cacert.pem 
        CApath: /home/my/www/test 
     [errno] => 77 

我使用tmhOAuth庫。

+0

你有沒有找到解決這個問題?我也遇到了它。 – VikingGoat

+0

@VikingGoat還沒有:/ – Chalist

+1

當我意識到它所指的文件(cacert.pem)缺失時,我在褲子時刻踢了一腳。事實證明,檔案文件在下載時被破壞,我必須重新獲得它,這給了我這些文件。 – VikingGoat

回答

0

您是否將應用程序設置設置爲'讀取&寫入'而不是'讀取'?

+0

是的,我設定了。 – Chalist

0

我有同樣的問題。我認爲OpenSsl需要安裝在你的php服務器上。

試試這個配置中構造

'curl_ssl_verifypeer'=>假,