This is my twitter class I am using to send the update:
class twitter {
private $user;
private $pass;
private $ch;
private $twitterHost = "http://twitter.com/";
public function __construct($username, $passwd) {
$this->user = $username;
$this->pass = $passwd;
/* Create and setup the curl Session */
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_VERBOSE, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_USERPWD, "$this->user:$this->pass");
curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($this->ch, CURLOPT_POST, 1);
}
public function __destruct() {
/*clean Up */
curl_close($this->ch);
}
public function setStatus($stat) {
if(strlen($stat) < 1)
return false;
/*Set the host information for the curl session */
$this->twitterHost .= "statuses/update.xml?status=".
urlencode(stripslashes(urldecode($stat)))."&source=krumlrpagekrums";
curl_setopt($this->ch, CURLOPT_URL, $this->twitterHost);
/* Execute and get the http code to see if it was succesfull or not*/
$result = curl_exec($this->ch);
$resultArray = curl_getinfo($this->ch);
if ($resultArray['http_code'] == 200) {
$_SESSION['twitter_result']=$resultArray;// save result to debug
return true;
}
$_SESSION['twitter_result']=$resultArray;
return false;
}
}
?>
On Tue, Dec 23, 2008 at 7:41 PM, Pete Wingard <[email protected]> wrote:
> Array
> (
> [url] =>
> http://twitter.com/statuses/update.xml?status=Michael+Arrington+questioning+Robert+Scoble+about+his+%E2%80%9Caddiction%E2%80%9D+to+Twitter+and+Friendfeed+http%3A%2F%2Fkrumlr.com%2Frj35hb&source=krumlrpagekrums
> [content_type] => text/html; charset=iso-8859-1
> [http_code] => 417
> [header_size] => 192
> [request_size] => 378
> [filetime] => -1
> [ssl_verify_result] => 0
> [redirect_count] => 0
> [total_time] => 0.126771
> [namelookup_time] => 0.002284
> [connect_time] => 0.06419
> [pretransfer_time] => 0.06428
> [size_upload] => 0
> [size_download] => 364
> [speed_download] => 2871
> [speed_upload] => 0
> [download_content_length] => 364
> [upload_content_length] => -1
> [starttransfer_time] => 0.126658
> [redirect_time] => 0
> )
>
>
> On Tue, Dec 23, 2008 at 7:40 PM, Alex Payne <[email protected]> wrote:
>
>>
>> Probably not? Wouldn't hurt to post it, though.
>>
>> On Tue, Dec 23, 2008 at 16:35, Pete Wingard <[email protected]>
>> wrote:
>> > can you tell by looking at the result array?
>> >
>> > On Tue, Dec 23, 2008 at 7:34 PM, Alex Payne <[email protected]> wrote:
>> >>
>> >> That's almost assuredly the result of a misconfigured proxy.
>> >>
>> >> On Tue, Dec 23, 2008 at 16:31, Pete Wingard <[email protected]>
>> wrote:
>> >> > it is a 417 error
>> >> >
>> >> > On Tue, Dec 23, 2008 at 6:29 PM, Pete Wingard <[email protected]
>> >
>> >> > wrote:
>> >> >>
>> >> >> no just whether or not it is 200
>> >> >>
>> >> >> On Tue, Dec 23, 2008 at 6:11 PM, Peter Denton <
>> [email protected]>
>> >> >> wrote:
>> >> >>>
>> >> >>> are you handling the rest of the http_code messages?
>> >> >>>
>> >> >>> On Tue, Dec 23, 2008 at 3:03 PM, krumlr <[email protected]>
>> wrote:
>> >> >>>>
>> >> >>>> I am using curl to send tweets and sometimes they don't go through
>> >> >>>> yet
>> >> >>>> I do not get an error message. The section of curl that should
>> take
>> >> >>>> care of this is
>> >> >>>>
>> >> >>>> /* Execute and get the http code to see if it was succesfull or
>> not*/
>> >> >>>> $result = curl_exec($this->ch);
>> >> >>>> $resultArray = curl_getinfo($this->ch);
>> >> >>>>
>> >> >>>> if ($resultArray['http_code'] == 200) ;
>> >> >>>> return true;
>> >> >>>>
>> >> >>>> any ideas why this is not working?
>> >> >>>>
>> >> >>>> Thanks
>> >> >>>> Pete
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Pete Wingard
>> >> >>
>> >> >> Krumlr.Com
>> >> >> MudSweatAndTears.Com
>> >> >> PixelCast.Net
>> >> >> TigerTailST.Com
>> >> >> & Yougler.Com
>> >> >>
>> >> >> you can follow on Twitter
>> >> >> http://www.twitter.com/krumlr
>> >> >>
>> >> >> Decatur, GA
>> >> >> 404.797.1646
>> >> >> http://yougler.com/pete
>> >> >> [email protected]
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Pete Wingard
>> >> >
>> >> > Krumlr.Com
>> >> > MudSweatAndTears.Com
>> >> > PixelCast.Net
>> >> > TigerTailST.Com
>> >> > & Yougler.Com
>> >> >
>> >> > you can follow on Twitter
>> >> > http://www.twitter.com/krumlr
>> >> >
>> >> > Decatur, GA
>> >> > 404.797.1646
>> >> > http://yougler.com/pete
>> >> > [email protected]
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Alex Payne - API Lead, Twitter, Inc.
>> >> http://twitter.com/al3x
>> >
>> >
>> >
>> > --
>> > Pete Wingard
>> >
>> > Krumlr.Com
>> > MudSweatAndTears.Com
>> > PixelCast.Net
>> > TigerTailST.Com
>> > & Yougler.Com
>> >
>> > you can follow on Twitter
>> > http://www.twitter.com/krumlr
>> >
>> > Decatur, GA
>> > 404.797.1646
>> > http://yougler.com/pete
>> > [email protected]
>> >
>>
>>
>>
>> --
>> Alex Payne - API Lead, Twitter, Inc.
>> http://twitter.com/al3x
>>
>
>
>
>