使用tmhOAuth库发生Twitter OAuth错误

时间:2013-01-21 12:37:10

标签: twitter 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库。

2 个答案:

答案 0 :(得分:0)

您是否已将应用程序设置设为“读取和放大”写',而不仅仅'读'?

答案 1 :(得分:0)

我遇到了同样的问题。我认为OpenSsl需要安装在你的php服务器上。

在配置构造函数中尝试此操作

'curl_ssl_verifypeer'=&gt;假,

相关问题