rammac13 Posted November 19, 2008 Share Posted November 19, 2008 What I want to do is dynamically get the information from one of my website statistic pages and put it into a table on another page. Is there a way to do this? Thanks Quote Link to comment Share on other sites More sharing options...
revraz Posted November 19, 2008 Share Posted November 19, 2008 CURL? Quote Link to comment Share on other sites More sharing options...
redarrow Posted November 19, 2008 Share Posted November 19, 2008 what about file_get_contents() function........... or soap Quote Link to comment Share on other sites More sharing options...
rammac13 Posted November 19, 2008 Author Share Posted November 19, 2008 I am very new at PHP are there any cURL tutorials or file_get_contents() function........... or soap? Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted November 20, 2008 Share Posted November 20, 2008 I have a cURL function that makes it really easy to use, I could give you the code, but if the file contents are on the same server I suggest using file_get_contents(); $string = file_get_contents($filename); Quote Link to comment Share on other sites More sharing options...
rammac13 Posted November 20, 2008 Author Share Posted November 20, 2008 Well I got the cURL to work. The Problem Is in all my Stats sites I and Others have to log in to be able to see them. I can't figure out a way to get past this. any Ideas? Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted November 20, 2008 Share Posted November 20, 2008 you can use cURL to submit form data, then the session and cookies are /** * cURL Quick Client * * @param string $url URL To access * @param array $postdata Data Array to Send to Page in POST Form * @param string $refer Referring URL * @return string HTML Document or Text returned from the site. */ function gethtml($url, $postdata = false, $refer = false) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url ); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); if($postdata) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata); } curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, $refer); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); $html = curl_exec ($ch); curl_close($ch); return $html; } $content = gethtml($url, $postdata, $refer); echo($content); Quote Link to comment Share on other sites More sharing options...
CroNiX Posted November 20, 2008 Share Posted November 20, 2008 Personally I would just use AJAX for this. If you are using a decent framework like mootools/jquery it would be simple. You can even grab a table from a page by using its ID and not have to parse the whole page or use a lot of php code filtering what you don't want to appear. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.