hello again, i'm trying to fetch data by curl + php from one site.. but not able to do coz there is damn too much privacy i guess.. here the code ... <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.factual.com/t/bi0eJZ/US_POI_and_Business_Listings_Beta'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12"); $data = curl_exec($ch); curl_close($ch); echo $data; ?> PHP: anyone know how to fetch that?? pls mode remove that if break rule or terms
Add this option and try again: curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); This will get the contents in case the page you request makes header redirections.
hey there isn't redirect problem.. there is prob with fetching data.. just try to on url and get known.. thx for reply though..
it seems that the content loads with ajax/iframes. You have to use a different option to simulate browser because it has to support ajax/js. this could be done using Perl/PHP under Windows that starts Firefox/IE The HTML code looks complex so I'd ask that site for a CSV file. You might have to pay extra for this but it will save you time in the long run because even though you could hire somebody to build you a parser you'll have to constantly check if the HTML code of the page you're parsing has changed.
yup. I got the solution by curl and php but I'm getting result very complex.. I must need to solve that data now.. thx for reply though anyone has anyother solution.. there is prob with posting data and getting back data which I want from...
I'm not sure if I'm sending you on the right track, but here's something to look at, it still throws an error but you might find a work around quicker. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.factual.com/t/bi0eJZ/US_POI_and_Business_Listings_Beta'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12"); $data = curl_exec($ch); curl_close($ch); $data = preg_replace('#link href="/#','link href="http://www.factual.com/',$data); $data = preg_replace('#script src="/#','script src="http://www.factual.com/',$data); $data = preg_replace('#a href="/topics#','a href="http://www.factual.com/topics',$data); $data = preg_replace('#action="/topics/find#','action="http://www.factual.com/topics/find',$data); echo $data; ?> PHP: