Michael Seton wrote:
> To Whom this may Concern,
>
> Basically what im try to do is this.... (please bear with me im a php
> noob)
> require a remote file, if its blank then instead display a comment or
> another file (which ever is easier)
>
>        Example:
>        *_if "http://launcher.worldofwarcraft.com/alert"; contains
>        nothing or contains "Not Found" or "404 error", display " Sorry
>        no updates at this time or No server notices at this time" or
>        include blah.php, otherwise display
>        _**_"http://launcher.worldofwarcraft.com/alert"._*
>
>
> Because the source is remotely updated, the information contained at
> this address is beyond my control, so i need this to control what is
> said on my end
> I'm not sure how to get this one to work
>
> Any help would be appreciated or a direction to where to find
> something that will help me,
>
> Pixmyster
>
> Guild Master
> Synergy Of Triumphalism
> Horde - Spinebreaker - US Realm
> World Of Warcraft Guild
> Website: www.synergyoftriumphalism.com
> Email: [EMAIL PROTECTED]
>
<?php
    $fp = fsockopen("launcher.worldofwarcraft.com", 80, $errno, $errstr,
30); //open the socket
    if (!$fp) // if the socket doesnt open, die
        die("$errstr ($errno)<br />\n");


    //construct http specific headers
    $out = "GET /alert HTTP/1.1\r\n";
    $out .= "Host: launcher.worldofwarcraft.com\r\n";
    $out .= "Connection: Close\r\n\r\n";

    $buff = ""; //generate a buffer to fille
    fwrite($fp, $out); //send the headers
    while (!feof($fp)) {
        $buff .= fgets($fp, 128); //read the response
    }

    fclose($fp); //close the socket

    if (strstr($buff, "404")) { //analyze.
        echo "no alerts";
    } else {
        echo "alerts";
    }
?>


-- 
==================
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==================

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to