themattharris / tmhOAuth

An OAuth 1.0A library written in PHP
Apache License 2.0
857 stars 335 forks source link

Problem when using on php 5.5.3 #161

Closed ghost closed 10 years ago

ghost commented 10 years ago

$res = $tmhOAuth->response['response']; $ard = json_decode($res, true);

In the above code, $ard should be an array but it isn't happening so in php 5.5.3. It was working fine in php 5.4.

themattharris commented 10 years ago

are you getting a 200 response code? also can you show the request you're making before inspecting the response

ghost commented 10 years ago

$args = array('id' => 1); $code = $tmhOAuth->request("GET", $tmhOAuth->url("https://api.twitter.com/1.1/trends/place.json"), $args); $res = $tmhOAuth->response['response'];

Yep I'm getting a 200 response code...

themattharris commented 10 years ago

lets var_dump tmhoauth->response and see what it looks like without json_decode

ghost commented 10 years ago

ok sorry my bad.... I was using 5.4 so got the 200 response....

on php 5.5, I get $http_response_header as NULL...

I can't var_dump tmhOauth->response because there's nothing in it...

ghost commented 10 years ago

Array ( [raw] => [code] => 0 [response] => [info] => Array ( [url] => https://api.twitter.com/1.1/trends/place.json?id=1 [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 8.047 [namelookup_time] => 0.047 [connect_time] => 0 [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 [redirect_url] => [primary_ip] => 199.59.148.87 [certinfo] => Array ( )

        [primary_port] => 443
        [local_ip] => 
        [local_port] => 0
    )

[error] => Failed connect to api.twitter.com:443; No error
[errno] => 7

)

Here is the response I actually get...

themattharris commented 10 years ago

so that means your machine isn't making a connection to api.twitter.com at all. given that PHP 5.4 is working for you suggests a compilation issue or missing library. does your PHP 5.5 build have the OpenSSL module enabled?

phpinfo(); should be able to tell you if OpenSSL is installed and recognized.

ghost commented 10 years ago

Oh yeah... I had the OpenSSL enabled...

Just rebuilt 5.5 and everything worked fine...

Thanks for the support.... :-)

themattharris commented 10 years ago

excellent. i'll close this out then