Simulating an automatic post in PHP

Ronnie Gauthier ronnieg
Thu Jun 15 19:26:30 PDT 2006


On Thu, 15 Jun 2006 10:59:09 +0800
Man-wai CHANG <mwchang at i-cable.com> wrote:


Maybe if you fix this statement it will work as expected.

bad = $NetGeoURL = "http://netgeo.caida.org/perl/netgeo.cgi?target=".$ip;

good = $NetGeoURL = "http://netgeo.caida.org/perl/netgeo.cgi?target=$ip";

 
> <?php
> 
> function getLocationCaidaNetGeo($ip)
> { 
> 	$NetGeoURL = "http://netgeo.caida.org/perl/netgeo.cgi?target=".$ip; 
> 	if($NetGeoFP = fopen($NetGeoURL,r))
> 	{ 
> 		ob_start();
> 		fpassthru($NetGeoFP);
> 		$NetGeoHTML = ob_get_contents();
> 		ob_end_clean();
> 		fclose($NetGeoFP);
> 	}
> 	return $NetGeoHTML;
> }
> 
> if ($HTTP_POST_VARS['btnsubmit']) {
> 		print_r(getLocationCaidaNetGeo($_POST['ip']));
> 	} else {
> ?>
> <form method="post" enctype="multipart/form-data" name="myform" action="<?php echo($PHP_SELF); ?>">
> <input type="text" name="ip">
> <input type="submit" name="btnsubmit" action="submit">
> </form>
> <?php
> }
> ?>
> </body></html>
> 
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
> 
> Need to chat further on this subject? Check out #linux-users on irc.linux-sxs.org !



More information about the Linux-users mailing list