Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] Opening Files via HTTP From: Jeff Wilhelm (jeffwilhelm <email protected>)
Date: 07/15/00

I use something this:

  class http
  {
    function http_fopen($host, $path)
 {
     $fp = fsockopen($host,80);
     if (!$fp)
  {
  return false;
  }
     fputs($fp,"GET $path HTTP/1.0\r\n");
     fputs($fp,"Host: $host\r\n\r\n");
     while(trim(fgets($fp,1024)) != ""); //removes HTTP headers
     return $fp;
 }
  }

Then this goes on the page to read the dynamic content with the variables
that are passed...

   $http = new http;

   $fp =
$http->http_fopen("$gDomain","/C003703/cgi-bin/news/news.cgi?start=$start&pe
rpage=$perpage&stop=$stop");

   if (!$fp){
    echo "Error accessing news archive.";

   } else {

    while (!feof($fp)) {
     $newsbuffer .= fgets($fp, 4096);
    }
   }
   /***Your $buffer parse....***/
   echo $newsbuffer;
   /******/
 ?>

J E F F R E Y M . W I L H E L M

  Phone: (860) 688-2976
  Voice Mail: (860) 285-7779 x2811
  Fax: (419) 735-8865
  E-Mail: jeff <email protected>
  Internet: http://www.jjjweb.com

Read my Epinions at: http://www.epinions.com/user-jwilhelm

----- Original Message -----
From: "Andrew" <fisherres <email protected>>
To: "PHP General" <php-general <email protected>>
Sent: Saturday, July 15, 2000 1:13 PM
Subject: [PHP] Opening Files via HTTP

> Hello,
>
> I have a PHP file and I want to read the contents of it via HTTP that
> way my dynamic content will show. How can I accomplish this?
>
> Andrew
> digi-FX
> -------------------------------
> http://www.digi-FX.net
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>