Re: Simulating a POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux