How to get language specific Skype status in text format

In my previous tip ‘How to get Skype status on the web application and make call or chat from web application’ I showed how to get skype status by getting a skype icon. But at times we need to get the skype status in text. Here I am giving an example of how to get skype status in text with language specification. But this language support is very limited between English,Portuguese-Brazil,Chinese-China, German,Japanese, Spanish, French, Italian, Polish ,Portuguese-Portugal,Swedish and Chinese-Taiwan.

We can do this by two ways. 1) Using only Java Script.

2) Using both Java Script and Server Script.

Using only Java Script has a drawback. For getting status we have make an Ajax call to skype server which will return an XML. It will work smoothly on IE (Tested on IE 7.0) but will not work on other browsers because other browsers restrict cross domain Ajax call.

To overcome this shortcoming I used Server side scripting(here PHP). In this example I make an Ajax call to my server side script which will get the XML from skype server and return the response to JavaScript.

I have used jQuery framework for Javascript coding because parsing XML data in javascript is very easy with jQuery. For testing no need to download jquery.js because this page jquery linked to Google CDN server. Otherwise download jQuery from http://jquery.com.

For testing only JS based script on IE copy below code and save as HTML and run.

 
  Status Info 
 
  
  
  function getSkypeDetail(){
   $('#output').html('Loading...');
   var id = $('#id').val();
   var language = $('#language').val();
   
   $.get(
    'http://mystatus.skype.com/'+id+'.xml',
    function(result) {
     $('#output').html('');
     $(result).find('presence').each(function(){
     if($(this).attr('xml:lang')==language)
     $('#output').append('
  • Status : ‘+$(this).text()+’
  • ');
         });
         
        },'xml'
       );
      }
      
     
     
      Enter Skype Id : 
    Select language : English Portuguese-Brazil Chinese-China German Japanese Spanish French Italian Polish Portuguese-Portugal Swedish Chinese-Taiwan
       
      

      For testing with server side scripting (here PHP)

      HTML Page

       
        Status Info
        
        
        
        function getSkypeDetail(){
         var id = $('#id').val();
         var language = $('#language').val();
         $('#output').html('Loading...');
         $.post(
          'skype_xml.php',
          {id:id},
          function(result) {
           $(result).find('presence').each(function(){
           if($(this).attr('xml:lang')==language){
           $('#output').html('');
           $('#output').append('
    • Status : ‘+$(this).text()+’
    • ');
           }
           });
           
          },'xml'
         );
        }
        
       
       
        Enter Skype Id : 
      Select language : English Portuguese-Brazil Chinese-China German Japanese Spanish French Italian Polish Portuguese-Portugal Swedish Chinese-Taiwan
         
        

        PHP page. Name of the page : skype_xml.php

        150 150 Burnignorance | Where Minds Meet And Sparks Fly!