themattharris / tmhOAuth

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

php5.6 #187

Open electrototo11 opened 8 years ago

electrototo11 commented 8 years ago

Hi, The program works with PHP5.5 but no longer works in 5.6, 403 error on my script :( How I can do ? Thanks

Clement87 commented 8 years ago

Same issue, any update ?

themattharris commented 8 years ago

the 403 will be coming back from Twitter with some message explaining what the cause of the 403 was. if you inspect $tmhOAuth->response i can suggest possible causes and investigate further.

Clement87 commented 8 years ago

Thanks for the quick reply but I put my production back in PHP 5.5 and don't have an other environment to test it. Maybe @electrototo11 can inspect the response ?

electrototo11 commented 8 years ago

Hi, The response is only : KO (403), no more... PHP version : 5.6.17

Clement87 commented 8 years ago

By the way, the problem only occurs (at least for me) when posting a tweet with a picture. Simple tweets (only text) was OK.

electrototo11 commented 8 years ago

yes, same for me

johannesnagl commented 8 years ago

we have this library working with php 5.6 for weeks now - no problem at all. as @themattharris pointed out, please have a look at the error message concerning your api call!

themattharris commented 8 years ago

can you var_dump $tmhOAuth->response and share what it says

ik0 commented 8 years ago

Hello, I had the same problem - after upgrade from php 5.5 to 7.0 tweets with picture stopped work with error 189 var_dump(json_decode($tmhOAuth->response['response'])) gives:

object(stdClass)#6 (1) { ["errors"]=> array(1) { [0]=> object(stdClass)#4 (2) { ["code"]=> int(189) ["message"]=> string(22) "Error creating status." } } }

To fix the problem I changed how attach image. I've changed this line

'media[]' => "@{$image};type=image/png;filename={$image}",

with

'media[]' => file_get_contents($image),

and now it's works. I don't know is this a change in twitter or PHP or somewhere else. Hope this will help someone.

electrototo11 commented 8 years ago

I try now it's works ! Perfect ! thanks ik0.

MarcosBL commented 7 years ago

Working fine, thanks @ik0 !