Re: Opening Files via HTTP

From: Date: Sat, 15 Jul 2000 17:18:22 +0000
Subject: Re: Opening Files via HTTP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6754@lists.php.net to get a copy of this message
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@jjjweb.com Internet: http://www.jjjweb.com Read my Epinions at: http://www.epinions.com/user-jwilhelm ----- Original Message ----- From: "Andrew" <fisherres@msn.com> To: "PHP General" <php-general@lists.php.net> 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@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#6754) next »