kausha-mehta / php-twitter

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

status updates sent as GET, not accepted by Twitter.com API #52

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Update status for a valid Twitter account, transferred in JSON.
2. Also include a reply-to id for a valid status message.
3. when twitter->update() is called, the curl request is executed as a GET
request while the Twitter API requires a POST request.

Note that I'm running this on PHP 5.3.0 on Mac OS X Snow Leopard, straight
from the box. Curl version info is:
Array
(
    [version_number] => 463620
    [age] => 3
    [features] => 573
    [ssl_version_number] => 0
    [version] => 7.19.4
    [host] => universal-apple-darwin10.0
    [ssl_version] => OpenSSL/0.9.8k
    [libz_version] => 1.2.3
    [protocols] => Array
        (
            [0] => tftp
            [1] => ftp
            [2] => telnet
            [3] => dict
            [4] => ldap
            [5] => http
            [6] => file
            [7] => https
            [8] => ftps
        )

)

What is the expected output? What do you see instead?
Expected output: updated status as stored by Twitter.

Actual output:
* About to connect() to twitter.com port 80 (#0)
*   Trying 168.143.162.68... * connected
* Connected to twitter.com (168.143.162.68) port 80 (#0)
* Server auth using Basic with user '**********'
> GET /statuses/update.json HTTP/1.1
Authorization: Basic *************************
Host: twitter.com
Accept: */*

< HTTP/1.1 400 Bad Request

What version of the product are you using? On what operating system?
v1.1

Please provide any additional information below.

I've resolved the problem by changing the Twitter class code in
Twitter::process(), by copying these two lines to line 740 (just before the
request is finalized and executed)

        if($postargs !== false)
        {
            curl_setopt ($ch, CURLOPT_POST, 1);
            curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);
        }

Kind Regards,
Gerben

Original issue reported on code.google.com by mac.g...@gmail.com on 7 Nov 2009 at 3:03