Re: Accessing a website from within a php script

From: Date: Tue, 13 Jan 2004 10:32:08 +0000
Subject: Re: Accessing a website from within a php script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174420@lists.php.net to get a copy of this message
Thanks Richard, > BS> My php program uses sends send some information to a .cgi file > BS> possibly on a different site. That file uses GET to fetch the > BS> information and prints it out as it would if accessed through a > BS> browser. But instead I want my php program to intercept this and parse > BS> what the .cgi file sent out. How can I do this? > > There are numerous ways to do this, but I'd probably just use > something as simple (and reliable) as fopen() using the URL with > embedded values as the parameter. > > $fp = > fopen("http://www.yourcgiscript.com?a=1&b=2&c=3/", > "r"); Here's what I do next with it. Only now this file (www.boggle.no/test6.php) times out in the brower. Do you see something that it obviously wrong here? <?php print '<html><body>' . "\n"; print 'test6.php<br>'; $fp = fopen("http://www.boggle.no/message.txt", "r"); $contents = fread($fp); print $contents; fclose ($fp); print '</body></html>' . "\n"; ?> -- Børge

« previous php.general (#174420) next »