Custom Skype online/offline status
Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: Custom Skype online/offline status

  1. #1
    Senior Member
    Join Date
    Oct 2007
    Posts
    466

    Custom Skype online/offline status

    I just wanted to post this because I searched forever & couldn't find anything. Maybe it will help someone else out or someone has something better.. Might not be the best solution, I have yet to see anything else, but it works.. With this you're able to use your own custom buttons, text, run something, etc. by determining the size of Skypes online/offline user buttons

    PHP Code:
    $button "http://mystatus.skype.com/smallicon/username.png";
    $status "status.png";
    copy($button$status);
    //online = 428  offline = 376
    if (filesize($status) > 400) {
        
    //online
    } else {
        
    //offline

    Last edited by coldwerturkey; 12-01-2008 at 08:59 AM.

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,433
    What about...

    PHP Code:
    function getSkypeStatus($username) {
        
    $data file_get_contents('http://mystatus.skype.com/' urlencode($username) . '.xml');
        
        return 
    strpos($data'<presence xml:lang="en">Offline</presence>') ? 'Offline' 'Online';
        
    // Or replace the two strings with integer 1 or 0 (or boolean TRUE or FALSE)
        // ... whatever you want

    or, slightly more versatile, ...
    PHP Code:
    function getSkypeStatus($username) {
        
    $data file_get_contents('http://mystatus.skype.com/' urlencode($username) . '.xml');
        
    preg_match('@<presence xml:lang="en">(.*?)</presence>@i'$data$match);

        return isset(
    $match[1]) ? $match[1] : 'Error retrieving status';


  3. #3

  4. #4
    Senior Member
    Join Date
    Oct 2007
    Posts
    466
    Quote Originally Posted by bradgrafelman View Post
    What about...

    PHP Code:
    function getSkypeStatus($username) {
        
    $data file_get_contents('http://mystatus.skype.com/' urlencode($username) . '.xml');
        
        return 
    strpos($data'<presence xml:lang="en">Offline</presence>') ? 'Offline' 'Online';
        
    // Or replace the two strings with integer 1 or 0 (or boolean TRUE or FALSE)
        // ... whatever you want

    or, slightly more versatile, ...
    PHP Code:
    function getSkypeStatus($username) {
        
    $data file_get_contents('http://mystatus.skype.com/' urlencode($username) . '.xml');
        
    preg_match('@<presence xml:lang="en">(.*?)</presence>@i'$data$match);

        return isset(
    $match[1]) ? $match[1] : 'Error retrieving status';

    sooo much better than that waste of time I was doing. thank you sir.

    Although for reference i think its better to search for an "online" and else the "offline" instead of how you have it as, if the status is Idle, Away, etc. the returned status would be "online" - which is usually what you're not when you are Idle, Away, etc.

  5. #5
    Junior Member
    Join Date
    May 2009
    Posts
    4
    I was looking at my website again and thought I need to have only the skype online image visible.

    I could not get the above code to work or the code in the other link I posted; so I made something that echoed the http://mystatus.skype.com/user.name.here.txt in the image name to display the image url I wanted from my server. :-)

    Code, image files, and instructions are here: http://www.abcpchelp.com/phpSkypeBut...tomButtons.zip

  6. #6
    Junior Member
    Join Date
    May 2009
    Posts
    4
    Quote Originally Posted by mvandiermen View Post
    Code, image files, and instructions are here: http://www.abcpchelp.com/phpSkypeBut...tomButtons.zip
    you can also use the to create any image you want for each skype status, you just need to edit the images in the folder

  7. #7
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Quote Originally Posted by mvandiermen View Post
    you can also use the to create any image you want for each skype status, you just need to edit the images in the folder
    Dear Sir,

    I've tried this but it is not working. It is giving me the following result where it is suppose to show the status image from skype_img directory.

    111.png

    It look like
    Code:
     {print $line;}?>
    couldn't the status/image name exactly. Can you help me sort out this?

  8. #8
    Senior Member
    Join Date
    Mar 2009
    Posts
    904
    Declare variables, not war.

  9. #9
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Quote Originally Posted by Bonesnap View Post
    Will you help here?

  10. #10
    Junior Member
    Join Date
    Feb 2014
    Posts
    1
    Quote Originally Posted by sherazi21st View Post
    Will you help here?
    No, but I will. Well... Adrian Speyer will.
    Create Custom Skype Buttons
    The PHP code.

  11. #11
    Junior Member
    Join Date
    May 2009
    Posts
    4
    Quote Originally Posted by sherazi21st View Post
    Dear Sir,

    I've tried this but it is not working. It is giving me the following result where it is suppose to show the status image from skype_img directory.

    111.png

    It look like
    Code:
     {print $line;}?>
    couldn't the status/image name exactly. Can you help me sort out this?

    Some time in 2014 Skype changed their button system and so current script is not working. If I check out the new system I could make one but do not have time right now.

  12. #12
    Senior Member cyberlew15's Avatar
    Join Date
    Aug 2002
    Location
    UK, Essex
    Posts
    277
    Quote Originally Posted by bradgrafelman View Post
    What about...

    PHP Code:
    function getSkypeStatus($username) {
        
    $data file_get_contents('http://mystatus.skype.com/' urlencode($username) . '.xml');
        
        return 
    strpos($data'<presence xml:lang="en">Offline</presence>') ? 'Offline' 'Online';
        
    // Or replace the two strings with integer 1 or 0 (or boolean TRUE or FALSE)
        // ... whatever you want

    or, slightly more versatile, ...
    PHP Code:
    function getSkypeStatus($username) {
        
    $data file_get_contents('http://mystatus.skype.com/' urlencode($username) . '.xml');
        
    preg_match('@<presence xml:lang="en">(.*?)</presence>@i'$data$match);

        return isset(
    $match[1]) ? $match[1] : 'Error retrieving status';


    Please for the love of whatever deity or system you ascribe value @file_get_contents. Also you only need to test for '>Offline</presence>' preg is using a machine digger to pot a plant, it only need to be as versatile.

    I would also advise taking in two POST arguments rather than one GET as you could have value, checksum to stop third-parties leeching off your site and lastly curl would be a slight improvement still because you could also detect HTTP status code in the event skype was too busy to respond (happened to me throughout 2012, ended up setting up an a href with "skype:username" in it during office hours
    Senior Digital Architect

  13. #13
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Contact Unit "Coping Mechanism"
    Posts
    22,048
    Quote Originally Posted by cyberlew15 View Post
    Please ... @file_get_contents
    Why? Apart from wanting to slow things down and to suppress logging an error message that would tell you that something is wrong?
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  14. #14
    Senior Member cyberlew15's Avatar
    Join Date
    Aug 2002
    Location
    UK, Essex
    Posts
    277
    Quote Originally Posted by Weedpacket View Post
    Why? Apart from wanting to slow things down and to suppress logging an error message that would tell you that something is wrong?
    Honestly it's because it looks terrible to have notices, warnings etc popping up on websites from a cosmetic point of view; coupled with the fact that file_get_contents was what was being pushed in all previous posts, it's the simplest remittance of the issue. Also turning down the reporting of errors (the only other way to fix using file_get_contents, does not affect the toll each error presents, which is what causes the slowdown regardless of suppression, it's not the suppression that causes the issue, just the error.

    If it makes you happier they can manually ob_start before the call, then ob_flush to get rid of the message, which also allows them to log, or to override error handler... I think that these are overkill, or they could adjust their error_reporting, which is basically plastering over the cracks of unstable code (as is using @ for suppression, but it at least signifies knowledge that file_get_contents is capable of failing to get files, so you can focus on remitting no content)

    All the best
    Senior Digital Architect

  15. #15
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,676
    Quote Originally Posted by cyberlew15
    Honestly it's because it looks terrible to have notices, warnings etc popping up on websites from a cosmetic point of view; coupled with the fact that file_get_contents was what was being pushed in all previous posts, it's the simplest remittance of the issue.
    That should be handled by logging instead of displaying errors in production.

    Quote Originally Posted by cyberlew15
    Also turning down the reporting of errors (the only other way to fix using file_get_contents, does not affect the toll each error presents, which is what causes the slowdown regardless of suppression, it's not the suppression that causes the issue, just the error.
    Turning down the reporting of errors is not the only other way to "fix" using file_get_contents, and it is not even the correct approach: rather, one should check for the possible errors in the first place, e.g., by calling file_exists prior to calling file_get_contents.

    Quote Originally Posted by cyberlew15
    If it makes you happier they can manually ob_start before the call, then ob_flush to get rid of the message, which also allows them to log, or to override error handler... I think that these are overkill, or they could adjust their error_reporting, which is basically plastering over the cracks of unstable code (as is using @ for suppression
    That is not overkill; that is being silly. file_get_contents is not "unstable code".

    Quote Originally Posted by cyberlew15
    it at least signifies knowledge that file_get_contents is capable of failing to get files, so you can focus on remitting no content)
    The fact that file_get_contents is capable of failing to get files should be handled by checking the return value for equivalence with false prior to using the contents retrieved.

    EDIT:
    Oh, but I see that the file name is actually some URL, in which case file_exists would not be applicable. Nonetheless, the "cosmetic point of view" would not have mattered: rather, one would have seen the errors in the log in the event that the URL was somehow incorrect or inaccessible: the function call would still have been essentially fine if its return value had been checked.
    Last edited by laserlight; 03-22-2015 at 09:25 AM.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •