Hello, here is my cURL output from the response. Its empty! I am
attaching both the code used and the response. I have been at this for
hours and cannot find out why this is happening. Thanks for your help.

TWITTER API CURL RESPONSE
url :: http://twitter.com/statuses/update.xml?status=test+agasdf
content_type ::
http_code :: 0
header_size :: 0
request_size :: 0
filetime :: -1
ssl_verify_result :: 0
redirect_count :: 0
total_time :: 0
namelookup_time :: 0.060027
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

CODE USED TO SEND REQUEST TO TWITTER
<?php

// A simple function using Curl to post (GET) to Twitter
// Kosso : March 14 2007

function postToTwitter($username,$password,$message){

    $host = "http://twitter.com/statuses/update.xml?status=".urlencode
(stripslashes(urldecode($message)));

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);

    $result = curl_exec($ch);
    // Look at the returned header
    $resultArray = curl_getinfo($ch);

    curl_close($ch);

    if($resultArray['http_code'] == "200"){
         $twitter_status='Your message has been sent! <a href="http://
twitter.com/'.$username.'">See your profile</a>';
    } else {
         $twitter_status="Error posting to Twitter. Retry<br><br>";
                        foreach ($resultArray as $key => $value) {
                                $twitter_status .= $key . " :: " . $value . 
"<br>";
                        }
    }
        return $twitter_status;
}
?>

Reply via email to