[twitter-dev] Re: Using Twitter API by Nick Beam

2009-08-31 Thread Andrew Badera
TEXT AVALANCHE! RUN!

∞ Andy Badera
∞ This email is: [ ] bloggable [x] ask first [ ] private
∞ Google me: http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)



On Mon, Aug 31, 2009 at 3:27 PM, Pj wrote:
>
> Can anyone please assist me on how to use/call this API functions with
> php?
>
> I tried
> 
> require("new.class.php");
>
> $twitter = new Twitter("", "");
>
> $msg = $twitter->getMessages("xml");
>
> echo "". $msg. "";
>
> ?>
>
> And something weird displayed..
> thanks in advance.
>
> //new.class.php\\
>  /**
>  * Twitter interface class
>  * Nov 26 2007 Nick Beam
>  * Bugs, comments, questions: winkerb...@gmail.com
>  * http://rbrw.net -- http://tinydinosaur.com
>  *
>  * This is a simple interface to the Twitter API.
>  * I've tried to keep as close as possible to the real API
>  *   calls (some had to be changed due to ambiguity), but all
>  *   of the arguments are as they are in the official docs.
>  *
>  * Usage:
>  *  $twitter = new Twitter("username", "password");
>  *  $public_timeline_xml = $twitter->getPublicTimeline("xml");
>  *
>  * Methods:
>  *  getPublicTimeline($format [, $since_id])
>  *  getFriendsTimeline($format [, $id [, $since ]])
>  *  getUserTimeline($format [, $id [, $count [, $since ]]])
>  *  showStatus($format, $id)
>  *  updateStatus($status)
>  *  destroyStatus($format, $id)
>  *  getReplies($format [, $page ])
>  *  getFriends($format [, $id ])
>  *  getFollowers($format [, $lite ])
>  *  getFeatured($format)
>  *  showUser($format [, $id [, $email ]])
>  *  getMessages($format [, $since [, $since_id [, $page ]]])
>  *  getSentMessages($format [, $since [, $since_id [, $page ]]])
>  *  newMessage($format, $user, $text)
>  *  destroyMessage($format, $id)
>  *  createFriendship($format, $id)
>  *  destroyFriendship($format, $id)
>  *  verifyCredentials([$format])
>  *  endSession()
>  *  getArchive($format [, $page ])
>  *  getFavorites($format [, $id [, $page ]])
>  *  createFavorite($format, $id)
>  *  destroyFavorite($format, $id)
>  *  lastStatusCode()
>  *  lastAPICall()
>  */
>
> class Twitter {
>        /* Username:password format string */
>        private $credentials;
>
>        /* Contains the last HTTP status code returned */
>        private $http_status;
>
>        /* Contains the last API call */
>        private $last_api_call;
>
>        /* Twitter class constructor */
>        function Twitter($username, $password) {
>                $this->credentials = sprintf("%s:%s", $username, $password);
>        }
>
>        function getPublicTimeline($format, $since_id = 0) {
>                $api_call = 
> sprintf("http://twitter.com/statuses/public_timeline.
> %s", $format);
>                if ($since_id > 0) {
>                        $api_call .= sprintf("?since_id=%d", $since_id);
>                }
>                return $this->APICall($api_call);
>        }
>
>        function getFriendsTimeline($format, $id = NULL, $since = NULL) {
>                if ($id != NULL) {
>                        $api_call = 
> sprintf("http://twitter.com/statuses/friends_timeline/
> %s.%s", $id, $format);
>                }
>                else {
>                        $api_call = 
> sprintf("http://twitter.com/statuses/friends_timeline.
> %s", $format);
>                }
>                if ($since != NULL) {
>                        $api_call .= sprintf("?since=%s", urlencode($since));
>                }
>                return $this->APICall($api_call, true);
>        }
>
>        function getUserTimeline($format, $id = NULL, $count = 20, $since =
> NULL) {
>                if ($id != NULL) {
>                        $api_call = 
> sprintf("http://twitter.com/statuses/user_timeline/%s.
> %s", $id, $format);
>                }
>                else {
>                        $api_call = 
> sprintf("http://twitter.com/statuses/user_timeline.%s";,
> $format);
>                }
>                if ($count != 20) {
>                        $api_call .= sprintf("?count=%d", $count);
>                }
>                if ($since != NULL) {
>                        $api_call .= sprintf("%ssince=%s", (strpos($api_call, 
> "?count=")
> === false) ? "?" : "&", urlencode($since));
>                }
>                return $this->APICall($api_call, true);
>        }
>
>        function showStatus($format, $id) {
>                $api_call = sprintf("http://twitter.com/statuses/show/%d.%s";, 
> $id,
> $format);
>                return $this->APICall($api_call);
>        }
>
>        function updateStatus($status) {
>                $status = urlencode(stripslashes(urldecode($status)));
>                $api_call = 
> sprintf("http://twitter.com/statuses/update.xml?status=
> %s", $status);
>                return $this->APICall($api_call, true, true);
>        }
>
>        function getReplies($format, $page = 0) {
>                $api_call = sprintf("http://twitter.com/statuses/replies.%s";,
> $format);
>        

[twitter-dev] Re: Using Twitter API by Nick Beam

2009-08-31 Thread Chris Babcock

Paste Bin - pastebin.com - is our friend.

Chris


On Mon, 31 Aug 2009 16:17:55 -0400
Andrew Badera  wrote:

> TEXT AVALANCHE! RUN!
> 
> ∞ Andy Badera
> ∞ This email is: [ ] bloggable [x] ask first [ ] private
> ∞ Google me:
> http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)
> 
> 
> 
> On Mon, Aug 31, 2009 at 3:27 PM, Pj wrote:
> >
> > Can anyone please assist me on how to use/call this API functions
> > with php?
> >
> > I tried
> >  >
> > require("new.class.php");
> >
> > $twitter = new Twitter("", "");
> >
> > $msg = $twitter->getMessages("xml");
> >
> > echo "". $msg. "";
> >
> > ?>
> >
> > And something weird displayed..
> > thanks in advance.
> >
> > //new.class.php\\
> >  > /**
> >  * Twitter interface class
> >  * Nov 26 2007 Nick Beam
> >  * Bugs, comments, questions: winkerb...@gmail.com
> >  * http://rbrw.net -- http://tinydinosaur.com
> >  *
> >  * This is a simple interface to the Twitter API.
> >  * I've tried to keep as close as possible to the real API
> >  *   calls (some had to be changed due to ambiguity), but all
> >  *   of the arguments are as they are in the official docs.
> >  *
> >  * Usage:
> >  *  $twitter = new Twitter("username", "password");
> >  *  $public_timeline_xml = $twitter->getPublicTimeline("xml");
> >  *
> >  * Methods:
> >  *  getPublicTimeline($format [, $since_id])
> >  *  getFriendsTimeline($format [, $id [, $since ]])
> >  *  getUserTimeline($format [, $id [, $count [, $since ]]])
> >  *  showStatus($format, $id)
> >  *  updateStatus($status)
> >  *  destroyStatus($format, $id)
> >  *  getReplies($format [, $page ])
> >  *  getFriends($format [, $id ])
> >  *  getFollowers($format [, $lite ])
> >  *  getFeatured($format)
> >  *  showUser($format [, $id [, $email ]])
> >  *  getMessages($format [, $since [, $since_id [, $page ]]])
> >  *  getSentMessages($format [, $since [, $since_id [, $page ]]])
> >  *  newMessage($format, $user, $text)
> >  *  destroyMessage($format, $id)
> >  *  createFriendship($format, $id)
> >  *  destroyFriendship($format, $id)
> >  *  verifyCredentials([$format])
> >  *  endSession()
> >  *  getArchive($format [, $page ])
> >  *  getFavorites($format [, $id [, $page ]])
> >  *  createFavorite($format, $id)
> >  *  destroyFavorite($format, $id)
> >  *  lastStatusCode()
> >  *  lastAPICall()
> >  */
> >
> > class Twitter {
> >        /* Username:password format string */
> >        private $credentials;
> >
> >        /* Contains the last HTTP status code returned */
> >        private $http_status;
> >
> >        /* Contains the last API call */
> >        private $last_api_call;
> >
> >        /* Twitter class constructor */
> >        function Twitter($username, $password) {
> >                $this->credentials = sprintf("%s:%s", $username,
> > $password); }
> >
> >        function getPublicTimeline($format, $since_id = 0) {
> >                $api_call =
> > sprintf("http://twitter.com/statuses/public_timeline. %s", $format);
> >                if ($since_id > 0) {
> >                        $api_call .= sprintf("?since_id=%d",
> > $since_id); }
> >                return $this->APICall($api_call);
> >        }
> >
> >        function getFriendsTimeline($format, $id = NULL, $since =
> > NULL) { if ($id != NULL) {
> >                        $api_call =
> > sprintf("http://twitter.com/statuses/friends_timeline/ %s.%s", $id,
> > $format); }
> >                else {
> >                        $api_call =
> > sprintf("http://twitter.com/statuses/friends_timeline. %s",
> > $format); }
> >                if ($since != NULL) {
> >                        $api_call .= sprintf("?since=%s",
> > urlencode($since)); }
> >                return $this->APICall($api_call, true);
> >        }
> >
> >        function getUserTimeline($format, $id = NULL, $count = 20,
> > $since = NULL) {
> >                if ($id != NULL) {
> >                        $api_call =
> > sprintf("http://twitter.com/statuses/user_timeline/%s. %s", $id,
> > $format); }
> >                else {
> >                        $api_call =
> > sprintf("http://twitter.com/statuses/user_timeline.%s";, $format);
> >                }
> >                if ($count != 20) {
> >                        $api_call .= sprintf("?count=%d", $count);
> >                }
> >                if ($since != NULL) {
> >                        $api_call .= sprintf("%ssince=%s",
> > (strpos($api_call, "?count=") === false) ? "?" : "&",
> > urlencode($since)); }
> >                return $this->APICall($api_call, true);
> >        }
> >
> >        function showStatus($format, $id) {
> >                $api_call =
> > sprintf("http://twitter.com/statuses/show/%d.%s";, $id, $format);
> >                return $this->APICall($api_call);
> >        }
> >
> >        function updateStatus($status) {
> >                $status =
> > urlencode(stripslashes(urldecode($status))); $api_call =
> > sprintf("http://twitter.com/statuses/update.xml?stat

[twitter-dev] Re: Using Twitter API by Nick Beam

2009-08-31 Thread Stuart

2009/8/31 Pj :
>
> Can anyone please assist me on how to use/call this API functions with
> php?
>
> I tried
> 
> require("new.class.php");
>
> $twitter = new Twitter("", "");
>
> $msg = $twitter->getMessages("xml");
>
> echo "". $msg. "";
>
> ?>
>
> And something weird displayed..
> thanks in advance.



You're asking for XML. I'm guessing you think XML is weird. I see no
problem here.

-Stuart

-- 
http://stut.net/projects/twitter/


[twitter-dev] Re: Using Twitter API by Nick Beam

2009-08-31 Thread Pj

Are there any Documentation to refer to?

On Sep 1, 1:22 am, Chris Babcock  wrote:
> Paste Bin - pastebin.com - is our friend.
>
> Chris
>
> On Mon, 31 Aug 2009 16:17:55 -0400
>
> Andrew Badera  wrote:
> > TEXT AVALANCHE! RUN!
>
> > ∞ Andy Badera
> > ∞ This email is: [ ] bloggable [x] ask first [ ] private
> > ∞ Google me:
> >http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)
>
> > On Mon, Aug 31, 2009 at 3:27 PM, Pj wrote:
>
> > > Can anyone please assist me on how to use/call this API functions
> > > with php?
>
> > > I tried
> > > 
> > > require("new.class.php");
>
> > > $twitter = new Twitter("", "");
>
> > > $msg = $twitter->getMessages("xml");
>
> > > echo "". $msg. "";
>
> > > ?>
>
> > > And something weird displayed..
> > > thanks in advance.
>
> > > //new.class.php\\
> > >  > > /**
> > >  * Twitter interface class
> > >  * Nov 26 2007 Nick Beam
> > >  * Bugs, comments, questions: winkerb...@gmail.com
> > >  *http://rbrw.net--http://tinydinosaur.com
> > >  *
> > >  * This is a simple interface to the Twitter API.
> > >  * I've tried to keep as close as possible to the real API
> > >  *   calls (some had to be changed due to ambiguity), but all
> > >  *   of the arguments are as they are in the official docs.
> > >  *
> > >  * Usage:
> > >  *  $twitter = new Twitter("username", "password");
> > >  *  $public_timeline_xml = $twitter->getPublicTimeline("xml");
> > >  *
> > >  * Methods:
> > >  *  getPublicTimeline($format [, $since_id])
> > >  *  getFriendsTimeline($format [, $id [, $since ]])
> > >  *  getUserTimeline($format [, $id [, $count [, $since ]]])
> > >  *  showStatus($format, $id)
> > >  *  updateStatus($status)
> > >  *  destroyStatus($format, $id)
> > >  *  getReplies($format [, $page ])
> > >  *  getFriends($format [, $id ])
> > >  *  getFollowers($format [, $lite ])
> > >  *  getFeatured($format)
> > >  *  showUser($format [, $id [, $email ]])
> > >  *  getMessages($format [, $since [, $since_id [, $page ]]])
> > >  *  getSentMessages($format [, $since [, $since_id [, $page ]]])
> > >  *  newMessage($format, $user, $text)
> > >  *  destroyMessage($format, $id)
> > >  *  createFriendship($format, $id)
> > >  *  destroyFriendship($format, $id)
> > >  *  verifyCredentials([$format])
> > >  *  endSession()
> > >  *  getArchive($format [, $page ])
> > >  *  getFavorites($format [, $id [, $page ]])
> > >  *  createFavorite($format, $id)
> > >  *  destroyFavorite($format, $id)
> > >  *  lastStatusCode()
> > >  *  lastAPICall()
> > >  */
>
> > > class Twitter {
> > >        /* Username:password format string */
> > >        private $credentials;
>
> > >        /* Contains the last HTTP status code returned */
> > >        private $http_status;
>
> > >        /* Contains the last API call */
> > >        private $last_api_call;
>
> > >        /* Twitter class constructor */
> > >        function Twitter($username, $password) {
> > >                $this->credentials = sprintf("%s:%s", $username,
> > > $password); }
>
> > >        function getPublicTimeline($format, $since_id = 0) {
> > >                $api_call =
> > > sprintf("http://twitter.com/statuses/public_timeline. %s", $format);
> > >                if ($since_id > 0) {
> > >                        $api_call .= sprintf("?since_id=%d",
> > > $since_id); }
> > >                return $this->APICall($api_call);
> > >        }
>
> > >        function getFriendsTimeline($format, $id = NULL, $since =
> > > NULL) { if ($id != NULL) {
> > >                        $api_call =
> > > sprintf("http://twitter.com/statuses/friends_timeline/%s.%s";, $id,
> > > $format); }
> > >                else {
> > >                        $api_call =
> > > sprintf("http://twitter.com/statuses/friends_timeline. %s",
> > > $format); }
> > >                if ($since != NULL) {
> > >                        $api_call .= sprintf("?since=%s",
> > > urlencode($since)); }
> > >                return $this->APICall($api_call, true);
> > >        }
>
> > >        function getUserTimeline($format, $id = NULL, $count = 20,
> > > $since = NULL) {
> > >                if ($id != NULL) {
> > >                        $api_call =
> > > sprintf("http://twitter.com/statuses/user_timeline/%s. %s", $id,
> > > $format); }
> > >                else {
> > >                        $api_call =
> > > sprintf("http://twitter.com/statuses/user_timeline.%s";, $format);
> > >                }
> > >                if ($count != 20) {
> > >                        $api_call .= sprintf("?count=%d", $count);
> > >                }
> > >                if ($since != NULL) {
> > >                        $api_call .= sprintf("%ssince=%s",
> > > (strpos($api_call, "?count=") === false) ? "?" : "&",
> > > urlencode($since)); }
> > >                return $this->APICall($api_call, true);
> > >        }
>
> > >        function showStatus($format, $id) {
> > >                $api_call =
> > > sprintf("http://twitter.com/statuses/show/%d.%s

[twitter-dev] Re: Using Twitter API by Nick Beam

2009-09-01 Thread Chris Babcock

> > Andrew Badera  wrote:  
> > > TEXT AVALANCHE! RUN!  
> > 
> On Sep 1, 1:22 am, Chris Babcock  wrote:
> > Paste Bin - pastebin.com - is our friend.

On Mon, 31 Aug 2009 18:49:26 -0700 (PDT)
Pj  wrote:

> Are there any Documentation to refer to?
 
If you are going to send more than one or two lines of sample code then
using pastebin or a similar site instead of sending the code by email
can help avoid the problem of leaving a brainy mess on the keyboard for
our spouses to clean up. I think that a link to pastebin.com is a
slightly more constructive, though significantly less cathartic,
approach than shouting "TEXT AVALANCHE! RUN!"

As for your question... In a Tweet, "docs twitter api php lib - Google
Search http://bit.ly/Ww09j " which brings us back to our punchline,
"Google is your friend."

Chris Babcock



[twitter-dev] Re: Using Twitter API by Nick Beam

2009-09-01 Thread Praveena Sarathchandra
sorry guys.
Thanks a lot for your help

Best Regards,

 Praveena J. Sarathchandra
 Freelance Web Designer/Developer

 [...@] pravee...@gmail.com
 [M] +94-77-6275266
 [W] www.ideabox.lk


On Tue, Sep 1, 2009 at 7:48 PM, Chris Babcock wrote:

>
> > > Andrew Badera  wrote:
> > > > TEXT AVALANCHE! RUN!
> > >
> > On Sep 1, 1:22 am, Chris Babcock  wrote:
> > > Paste Bin - pastebin.com - is our friend.
>
> On Mon, 31 Aug 2009 18:49:26 -0700 (PDT)
> Pj  wrote:
>
> > Are there any Documentation to refer to?
>
> If you are going to send more than one or two lines of sample code then
> using pastebin or a similar site instead of sending the code by email
> can help avoid the problem of leaving a brainy mess on the keyboard for
> our spouses to clean up. I think that a link to pastebin.com is a
> slightly more constructive, though significantly less cathartic,
> approach than shouting "TEXT AVALANCHE! RUN!"
>
> As for your question... In a Tweet, "docs twitter api php lib - Google
> Search http://bit.ly/Ww09j " which brings us back to our punchline,
> "Google is your friend."
>
> Chris Babcock
>
>