Hello everyone,
Just wondering if this were possible to do... Right now, I have a script that uses SigmaChat for my bulletin board, and it queries the remote server.. It works just great --- except when their server is offline. This is my CURRENT php script called via cron every 5 minutes:

<?php include("http://client0.sigmachat.com/scwho.pl?id=xxxxxx&subroom=0&boldadmin=1&comma=1&countonly=0&chatbg=000000&chatusr=FFFFFF&subroomcolor=FFFFFF&chatadmusr=00FFFF&nousermsg=<smallfont>There+are+currently+no+users+in+chat.<%2Fsmallfont>"); ?>

What i'm looking to do, is basically this:
If return value is sucessful, then write the contents to > test.html
if cannot connect to remote server, write "Chat Information Temporarily Unavailable" to >test.html

I currently call the scripts via cron by doing this:
/5 * root /usr/local/bin/php /home/user1/maint/numchat.php > /home/user1/maint/chat/numchat.html

Can anyone supply any help on getting this completed? Many thanks!

    Perhaps...

    if(!($data = @file_get_contents('http://client0.sigmachat.com/scwho.pl?id=xxxxxx&subroom=0&boldadmin=1&comma=1&countonly=0&chatbg=000000&chatusr=FFFFFF&subroomcolor=FFFFFF&chatadmusr=00FFFF&nousermsg=<smallfont>There+are+currently+no+users+in+chat.<%2Fsmallfont>')))
        echo 'Chat Information Temporarily Unavailable';
    else
        echo $data;

      if you are doing lots of pages remotely then you may find multithreasing advice on PHP CLI very useful. They say that you can speed up your script up to 100 times. 🙂

        Awesome, that worked like a charm!! Thanks a lot!

          Write a Reply...