NYCPHP Meetup

NYPHP.org

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

Phil Powell soazine at erols.com
Thu Oct 3 00:24:51 EDT 2002


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\
";
         $request .= "Host: $address\
";
         $request .= "Content-Length: " . strlen( $post ). "\
";
         $request .= "Content-Type: application/x-www-form-urlencoded\
";

         if ($cookie) $request .= "Cookie: $cookie\
";

         $request .= "Connection: Close\
\
";
         $request .= $post;
      } else {
         $request = "GET $url HTTP/1.1\
";
         $request .= "Host: $address\
";
         $request .= "Content-Type: text/html\
";

         if ($cookie) $request .= "Cookie: $cookie\
";

         $request .= "Connection: Close\
\
";
      }

      $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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20021003/d63969de/attachment.html>


More information about the talk mailing list