Re: Simulating a POST

From: Date: Thu, 15 Jun 2006 09:04:57 +0000
Subject: Re: Simulating a POST
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-238063@lists.php.net to get a copy of this message
Man-wai Chang schrieb:
Here is the new version: ------------------------------------------------------------------------ <?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 { ?> <html><head></head> <body onload=document.myform.submit()> <form method="post" enctype="multipart/form-data" name="myform"> <input type="text" name="ip"> <input type="submit" name="btnsubmit" value="submit"> </form> </body></html> <?php } ?>
Ah forgot something. You still are not able to fill out anything because it submittes itself automatically. you have to remove that onload. Otherwise the post will still be empty and it will reload itself again and again. Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

« previous php.general (#238063) next »