customizetalk.com Forum Index customizetalk.com
Customizing Google Talk
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[PHP-Tutorial] Show your Google Talk status on your website

 
Post new topic   Reply to topic    customizetalk.com Forum Index -> Google Talk Development -> Web Development
View previous topic :: View next topic  
Author Message
vikke
Moderator
Moderator


Joined: 14 Sep 2005
Posts: 867

PostPosted: Tue Jan 17, 2006 6:38 pm    Post subject: [PHP-Tutorial] Show your Google Talk status on your website Reply with quote

Start
I'm gonna show you how to get your own Google Talk status on your webpage. Thanks to fantawttw for his Online Status application that we will use. My english isn't good, so you can post if I've spelled anything wrong.


Step 1: Add jabberonlinestatus [at] jabber.org (old: gtalkonlinestatus [at] googlemail.com) to your contact list.
After the bot accept you as a friend (can take up to 5 seconds), send a message with the text
Quote:
ENCSTRING
He will answer you with this text where (enc) is your own encrypted string.
Quote:
You may now change the image that is displayed simply use one of the following to change the style returned
http://www.jonburrows.co.uk/gtalkstatus/1/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/2/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/3/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/4/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/5/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/7/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/8/(enc).jpg
http://www.jonburrows.co.uk/gtalkstatus/9/(enc).jpg

Save the text that replaces (enc) somewhere (maybe on a paper, maybe in a notepad-document) because we'll use it soon.


Step 2: Open your PHP-site in your editor, find a place in your HTML-code where you want to show the text. We'll use the file-function (follows PHP5). Then copy & paste this code:
Code:
<?php
// Set your enc-string between the quotes
$enc = "";
// Put the url together
$url = 'http://www.jonburrows.co.uk/gtalkstatus/6/' . $enc . '.jpg';
// Save the site as a array of lines
$lines = file($url);
// Loop through all lines
foreach($lines as $line){
   // Looks if it returns 1 that means that you are available
   if($line == 1){
      echo "I'm available at Google Talk";
   }
   // Else you are not available
   else{
      echo "I'm not available at Google Talk";
   }
}
?>

And write your (enc) text that you saved between the quotes. Now you can see if you are available or not available. Available means Online, Busy, Idle, and unavailable means offline. Now if you want you can show different images depending on if you are available or not. Its easy just change "I'm available at Google Talk" to "<IMG SRC="myimage.gif">" and "I'm not available at Google Talk" to "<IMG SRC="myimage2.gif">".


Step 3: It wasn't funny enough with just showing if you are available or not, so I'm going to show your current status. Its just small changes. Here is the code:
Code:
<?php
// Set your enc-string between the quotes
$enc = "";
// Put the url together
$url = 'http://www.jonburrows.co.uk/gtalkstatus/7/' . $enc . '.jpg';
// Save the site as a array of lines
$lines = file($url);
// Loop through all lines
foreach($lines as $line){
   // Print the text that Gtalkstatus gives us
   echo $line;
}
?>


Step 4: Now we're going to look if we are Idle, Available, Busy, Offline, Chatty (like available) and xa (extended idle). Chatty and xa isn't available in the current version of Google Talk but its supported in the protocol XMPP, like bots can have that status and you can maybe have it with a another Google Talk Client. Every status have a number that Gtalkstatus returns when you request the site. Here's the list:

  • 1 = Available
  • 2 = Busy
  • 3 = Idle
  • 4 = Chatty
  • 5 = xa
  • 0 and else = Unavailable


Code:
<?php
// Set your enc-string between the quotes
$enc = "";
// Put the url together
$url = 'http://www.jonburrows.co.uk/gtalkstatus/8/' . $enc . '.jpg';
// Save the site as a array of lines
$lines = file($url);
// Loop through all lines
foreach($lines as $line){
// Check what number Gtalkstatus returns
if($line == "1"){
   echo "I'm available";
}
elseif($line == "2"){
   echo "I'm busy";
}
elseif($line == "3"){
   echo "I'm idle";
}
elseif($line == "4"){
   echo "I'm chatty";
}
elseif($line == "5"){
   echo "I'm idle extended";
}
else{
  echo "I'm unavailable";
}
}
?>


Edit 1: You can change this (because Google Talk shows xa as idle and chatty as available) :
Code:
elseif($line == "4"){
   echo "I'm chatty";
}
elseif($line == "5"){
   echo "I'm idle extended";
}
to
Code:
elseif($line == "4"){
   echo "I'm available";
}
elseif($line == "5"){
   echo "I'm idle";
}


Thats all Wink I hope this has been useful, you can open for example http://www.google.com/ with the file()-command and replace Google with your name or something fun Smile. For more advanced HTTP-Get functions use cURL and libcurl. libcurl is supported by the most programming languages (ex. VB, C++, and .NET).
Back to top
View user's profile Send private message   MSN Messenger Google Talk
Your Ad Here
inquild
Guest





PostPosted: Sat Jul 26, 2008 8:57 pm    Post subject: new movie releases sept 2007 sophia loren cary grant movies Reply with quote

online movie short film movie shrimp on the barbie
Back to top
oliver
Talk n00bie


Joined: 28 Feb 2008
Posts: 1

PostPosted: Wed Mar 25, 2009 12:36 am    Post subject: Reply with quote

jonburrows isn't working any more but you can get the same service here:

imstatuscheck . com

it also has APIs for developers and text and XML output
Back to top
View user's profile Send private message  
Display posts from previous:   
Post new topic   Reply to topic    customizetalk.com Forum Index -> Google Talk Development -> Web Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group