eliza81 Posted February 9, 2010 Share Posted February 9, 2010 Here is a function which will help you to read the page content of a given link and return the data in an array. So that you can use the data as per your requirement. /** FUNCTION TO RETURN PAGE CONTENT OF GIVEN URL****/ public function HttpRequest( $url, $method = 'GET', $data = NULL, $additional_headers = NULL, $followRedirects = true ) { $method = strtoupper($method); /************************/ /*Parse the given url */ /***********************/ $url_parsed = @parse_url($url); if (!@$url_parsed['scheme']) $url_parsed = @parse_url('http://'.$url); /******************************************************************/ /*Extract the parseed url values */ /*It will get the variables $scheme,$host,$port,$user,$pass,$path,$query,$fragment */ /****************************************************************/ extract($url_parsed); /***********************************************************/ /*Check if any data is there to post along with the url */ /**********************************************************/ if(!is_array($data)) { $data = NULL; }else{ $ampersand = ''; $temp = NULL; foreach($data as $k => $v) { $temp .= $ampersand.urlencode($k).'='.urlencode($v); $ampersand = '&'; } $data = $temp; } Link to comment Share on other sites More sharing options...
jeffman Posted February 9, 2010 Share Posted February 9, 2010 Function isn't complete anyway. Was this just spam? Link to comment Share on other sites More sharing options...
Redroest Posted February 9, 2010 Share Posted February 9, 2010 First of all, put it between code tags and second, it is not complete. I also think that the purpose of this forum is asking questions or anwer them, not to post random scripts. There are many other websites that have a script library. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.