SalmanAzmat / php-twitter

Automatically exported from code.google.com/p/php-twitter
0 stars 0 forks source link

sendDirectMessage() not working (incl. fix) #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to send a new direct message

What is the expected output? What do you see instead?
Twitter replies with a '400' and no direct message is sent.

What version of the product are you using? On what operating system?
1.1 and 1.2-alpha on different servers

Please provide any additional information below.
Every time I tried to use this function I got:
Warning: Invalid argument supplied for foreach() in
/www/htdocs/twitter/classes/class.twitter.new.php on line 764

The solution is to replace the following code in the sendDirectMessage()
function:
>> $postargs = 'user=' . rawurlencode($user) . '&text=' . rawurlencode($text);

with

>> $postargs = array( 'user' => rawurlencode($user), 'text' =>
rawurlencode($text));

because foreach() requires an Array(), but it's given a String instead.

Original issue reported on code.google.com by dien...@gmail.com on 30 Jun 2009 at 1:18