0 Members and 1 Guest are viewing this topic.
<?php$url = "";//Try to fetch the urlforeach ( $_GET as $key => $value ){ //I know this method isn't entirely secure, but it gets the job done ;) if ( eregi("http://", $key) ) { $url = $key; }}//Do what you want with the url?$contents = file_get_contents($url); //GET$contents = http_post_data($url, Array("key" => "value")); //POST, sending $_POST["key"] = "value";?>
No, I don't think you have the updated code:Code: [Select]<?php$url = "";//Try to fetch the urlforeach ( $_GET as $key => $value ){ //I know this method isn't entirely secure, but it gets the job done ;) if ( eregi("http://", $key) ) { $url = $key; }}//Do what you want with the url?$contents = file_get_contents($url); //GET$contents = http_post_data($url, Array("key" => "value")); //POST, sending $_POST["key"] = "value";?>New errors:Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/a6670055/public_html/free.php on line 16PHP Error MessageWarning: file_get_contents(http://www_google_com) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/a6670055/public_html/free.php on line 16PHP Error MessageFatal error: Call to undefined function http_post_data() in /home/a6670055/public_html/free.php on line 17
Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/a6670055/public_html/free.php on line 16
<?php$url = "";//Try to fetch the urlforeach ( $_GET as $key => $value ){ //I know this method isn't entirely secure, but it gets the job done ;) if ( eregi("http://", $key) ) { $url = $key; }}//Do what you want with the url?$contents = file_get_contents(str_replace('_', '.', $url)); //GETecho $contents;?>
That last code works on my own server, which runs on PHP 4.3.0Unless your host as safemode enabled, which blocks external connections.Consider looking for another host? (I believe www.freehostia.com works fine)