[twitter-dev] api/php problem

2009-06-27 Thread david

Im having trouble writing a script that tweets the title and urls of
events getting posted. I go to texas aM and am trying to tweet the
games and other events, so my literal tweet is

AM vs tu Football Game http://www.mysite.com/beta/showevent1.php?id=482

but it only tweets A...thats it OR it doesn't show up. The first one
that gets tweeted with AM at the start shows up as A, but then if the
very next one that starts with AM won't show up at all.

but if the tweet doesn't start with AM, say the tweet is

Blaggards Concert http://www.mysite.com/beta/showevent1.php?id=483

then it works perfect. Tweets every time. I'm also checking to see if
the curl is successfulif it is--update my tweet column to show
that it has been tweeted. The ones that start with AM that come after
the A tweet don't show up on the twitter account, but DO get
updated.

heres my script


?php
include(caneck.inc);

$cxn = mysqli_connect($host,$user,$passwd,$dbname)
  or die (Couldn't connect);

//grab the first event that hasn't been tweeted
 $sql = SELECT * FROM `test` WHERE tweet = '0' limit 1;
   $result = mysqli_query($cxn,$sql)
 or die (mysqli_error($result));


   $list = mysqli_fetch_assoc($result);

$agurl =  http://www.mysite.com/beta/showevent1.php?id={$list['eventid']};

$id = $list['eventid'];

$title = stripslashes($list['title']);

$tweet = $title. .$agurl;

$username = 'myusername';
$password = 'mypassword';
// The message you want to send
// The twitter API address
//$urlb = 'http://twitter.com/statuses/update.xml';
// Alternative JSON version
$urlb = 'http://twitter.com/statuses/update.json';
// Set up and execute the curl process
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $urlb);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, status=$tweet);
curl_setopt($curl_handle, CURLOPT_USERPWD, $username:$password);

//if tweet is successful, update row to reflect that
if(curl_exec($curl_handle))
{
$sqr = Update test SET tweet = '1' WHERE eventid = $id;
$res = mysqli_query($cxn,$sqr)
 or die (mysqli_error($res));
}
else
{

}


curl_close($curl_handle);

echo $title;
echo $agurl;

echo brbr;

echo $tweet;
?

So my twitter account ends up looking like so after a few tweets

inaggietest Johnny Cooper Band http://bit.ly/1f3Go
26 minutes ago from web

inaggietest A
27 minutes ago from web

inaggietest Aaron Watson http://bit.ly/xCpR
28 minutes ago from web


inaggietest A
29 minutes ago from web


inaggietest College Station Knitting Meetup http://bit.ly/vbHr
30 minutes ago from web


inaggietest JEFF DUNHAM @ FIRST YELL http://bit.ly/fagF


[twitter-dev] Re: api/php problem

2009-06-27 Thread Chad Etzel

Need to urlencode() the tweets.. the  is screwing it up for you.

-Chad

On Sat, Jun 27, 2009 at 5:43 PM, davidda...@inaggieland.com wrote:

 Im having trouble writing a script that tweets the title and urls of
 events getting posted. I go to texas aM and am trying to tweet the
 games and other events, so my literal tweet is

 AM vs tu Football Game http://www.mysite.com/beta/showevent1.php?id=482

 but it only tweets A...thats it OR it doesn't show up. The first one
 that gets tweeted with AM at the start shows up as A, but then if the
 very next one that starts with AM won't show up at all.

 but if the tweet doesn't start with AM, say the tweet is

 Blaggards Concert http://www.mysite.com/beta/showevent1.php?id=483

 then it works perfect. Tweets every time. I'm also checking to see if
 the curl is successfulif it is--update my tweet column to show
 that it has been tweeted. The ones that start with AM that come after
 the A tweet don't show up on the twitter account, but DO get
 updated.

 heres my script


 ?php
 include(caneck.inc);

 $cxn = mysqli_connect($host,$user,$passwd,$dbname)
          or die (Couldn't connect);

 //grab the first event that hasn't been tweeted
  $sql = SELECT * FROM `test` WHERE tweet = '0' limit 1;
   $result = mysqli_query($cxn,$sql)
             or die (mysqli_error($result));


   $list = mysqli_fetch_assoc($result);

 $agurl =  http://www.mysite.com/beta/showevent1.php?id={$list['eventid']};

 $id = $list['eventid'];

 $title = stripslashes($list['title']);

 $tweet = $title. .$agurl;

 $username = 'myusername';
 $password = 'mypassword';
 // The message you want to send
 // The twitter API address
 //$urlb = 'http://twitter.com/statuses/update.xml';
 // Alternative JSON version
 $urlb = 'http://twitter.com/statuses/update.json';
 // Set up and execute the curl process
 $curl_handle = curl_init();
 curl_setopt($curl_handle, CURLOPT_URL, $urlb);
 curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
 curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($curl_handle, CURLOPT_POST, 1);
 curl_setopt($curl_handle, CURLOPT_POSTFIELDS, status=$tweet);
 curl_setopt($curl_handle, CURLOPT_USERPWD, $username:$password);

 //if tweet is successful, update row to reflect that
 if(curl_exec($curl_handle))
 {
 $sqr = Update test SET tweet = '1' WHERE eventid = $id;
 $res = mysqli_query($cxn,$sqr)
             or die (mysqli_error($res));
 }
 else
 {

 }


 curl_close($curl_handle);

 echo $title;
 echo $agurl;

 echo brbr;

 echo $tweet;
 ?

 So my twitter account ends up looking like so after a few tweets

 inaggietest Johnny Cooper Band http://bit.ly/1f3Go
 26 minutes ago from web

 inaggietest A
 27 minutes ago from web

 inaggietest Aaron Watson http://bit.ly/xCpR
 28 minutes ago from web


 inaggietest A
 29 minutes ago from web


 inaggietest College Station Knitting Meetup http://bit.ly/vbHr
 30 minutes ago from web


 inaggietest JEFF DUNHAM @ FIRST YELL http://bit.ly/fagF



[twitter-dev] Re: user ambiguity

2009-06-27 Thread Nick Arnett
On Sat, Jun 27, 2009 at 4:05 PM, Christine christine.kar...@gmail.comwrote:


 On Jun 27, 9:55 pm, Nick Arnett nick.arn...@gmail.com wrote:
  There are parameters available to avoid the ambiguity.
  See
 http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-user_t...

 Yes, I know, that's what I am now using. I was just wondering why
 there should be such an ambiguity in the api.


That's what happens when people don't think of everything in the first
release.

;-)

Nick


[twitter-dev] OAuth IDN/Punycode domain names

2009-06-27 Thread Harrison

Hi there,

I'm wondering if there are plans to recognise IDN domain names as
valid in the OAuth application setup pages? My domain itself (http://
✪➝.ws/) isn't recognised as valid URL format which is understandable,
however the punycode version of the same domain name (http://
xn--2ci9n.ws/) also isn't recognised. This is suboptimal and requires
me to do some ugly domain hacks to get basic callback functionality in
place.

Thanks.