With CURLOPT_VERBOSE option set to 1, you should see the whole http
communication. It would help to understand what's going on.You're probably
not outputing errors (don't see any http trace) so try to set the
CURLOPT_STDERR option to some file PHP can write to, and send us its content
(remind to hide the auth part).

-- 
Arnaud Meunier
Twitoaster | http://twitoaster.com

2009/7/13 nordmograph <adrous...@gmail.com>

>
> Hi thank you both of you for your quick replies!
> Yes Zero means denied but the tweet is posted and listed fine
> It is not sometimes, it is always... unfortunately.
> CURLOPT_VERBOSE option is 1 and here is what my postToTwitter function
> looks like:
>
> 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=_CBTW_TWEETSENT;
>                                else
>                                        $twitter_status=_CBTW_ERRORRETRY;
> }
>
> and then
>
> if(isset($_POST['twitter_msg']) && !isset($error)){
>                                $return .='<div class="msg">'.
> $twitter_status .'</div>';
>                                $twitter_message=$_POST['twitter_msg'];
>                                if(strlen($twitter_message)<1)
>                                        $error=1;
>                                else
>
>  $twitter_status=postToTwitter($twittername, $twitterpass,
> $twitter_message);
>                        }
>
> the tweet is posted fine to my twitter page
> and here is the result:
>
> Array
> (
>    [url] => http://twitter.com/statuses/update.xml?status=so+hot+in+here
>    [http_code] => 0
>    [header_size] => 0
>    [request_size] => 211
>    [filetime] => -1
>    [ssl_verify_result] => 0
>    [redirect_count] => 0
>    [total_time] => 0.254544
>    [namelookup_time] => 0.081081
>    [connect_time] => 0.254497
>    [pretransfer_time] => 0.254505
>    [size_upload] => 0
>    [size_download] => 0
>    [speed_download] => 0
>    [speed_upload] => 0
>    [download_content_length] => 0
>    [upload_content_length] => -1
>    [starttransfer_time] => 0.254539
>    [redirect_time] => 0
> )
>
> Thanks a lot for your help!

Reply via email to