Re: How do you strip Header Info from displaying on your browser?

From: Date: Thu, 03 Oct 2002 08:33:35 +0000
Subject: Re: How do you strip Header Info from displaying on your browser?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118708@lists.php.net to get a copy of this message
Throw out everything untill you get second empty line Phil Powell wrote:
If you go to http://valsignalandet.com/feedback.php you can get a clearer indication of what I am trying to get rid of. Following is my function using to produce the stuff up there, which I don't want, instead, I either want cookie-driven information or nothing (if no cookie is set): function WebGet($address, $port = 80, $url = '/', $post = false, $cookie = false) { // Use fsockopen to catch the URL $fp = fsockopen ( $address, $port); // Zero Fill $ret = ''; if ($fp) {
     // Success.  Now check to see the type of request      if ($post) {
        $request = "POST $url HTTP/1.1\n";
        $request .= "Host: $address\n";
        $request .= "Content-Length: " . strlen( $post ). "\n";
        $request .= "Content-Type: application/x-www-form-urlencoded\n";
        if ($cookie) $request .= "Cookie: $cookie\n";
        $request .= "Connection: Close\n\n";
        $request .= $post;
     } else {
        $request = "GET $url HTTP/1.1\n";
        $request .= "Host: $address\n";
        $request .= "Content-Type: text/html\n";
        if ($cookie) $request .= "Cookie: $cookie\n";
        $request .= "Connection: Close\n\n";
     }
     $ret = '';
     // Write the Request      fputs ($fp, $request);
     // Get the response      while (!feof($fp)) $ret .= fgets ( $fp, 128 );
     // close the connection      fclose ($fp);
} return $ret; } I do not want to change WebGet as I wish to keep it a universal function that can be used for cookies or not. So, how can I get rid of the trash on my page? Thanx Phil


« previous php.general (#118708) next »