adv Posted October 17, 2011 Share Posted October 17, 2011 How do i load a page that is entirely made in javascript i`ve tried to load a page but its not loading it <td valign="middle"><b id="loadingMessage">Loading...</b></td> its keeps getting stuck at Loading I have FOLLOWLOCATION 1 $ch = curl_init(); curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" ); curl_setopt( $ch, CURLOPT_URL, $url1 ); curl_setopt( $ch, CURLOPT_COOKIEJAR, $cook ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch, CURLOPT_ENCODING, "" ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_AUTOREFERER, true ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout ); curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout ); curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 ); $content = curl_exec( $ch ); $response = curl_getinfo( $ch ); curl_close ( $ch ); echo $content; print_r( $response); how do i load a page that is made in javascript with curl ? or does it have hidden .htm files that are loading through javascript Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/ Share on other sites More sharing options...
.josh Posted October 18, 2011 Share Posted October 18, 2011 You cannot do this with curl. You need to use curl to grab the page content initially and then run it through something that will parse it, like what a browser does. Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280095 Share on other sites More sharing options...
xyph Posted October 18, 2011 Share Posted October 18, 2011 I would instead write a script that parses the AJAX calls and scrapes the URLs specified there. Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280097 Share on other sites More sharing options...
.josh Posted October 18, 2011 Share Posted October 18, 2011 I would instead write a script that parses the AJAX calls and scrapes the URLs specified there. ...well ajax is just one part of javascript...the page may not even have any ajax calls on it. Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280110 Share on other sites More sharing options...
adv Posted October 18, 2011 Author Share Posted October 18, 2011 and is there a way to parse it with some function or something similar ? and can u please give me an example .. Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280170 Share on other sites More sharing options...
.josh Posted October 18, 2011 Share Posted October 18, 2011 and is there a way to parse it with some function or something similar ? and can u please give me an example .. There is no built-in php function to parse javascript. It is a different language, simple as that. I believe I have seen some people attempt to make scripts that will parse javascript, but this is not really the same as actually executing it within a DOM environment. In order to get the code as you would see in a live DOM in a browser, you basically have to emulate a browser on your server. This is beyond the scope of php alone. Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280178 Share on other sites More sharing options...
xyph Posted October 18, 2011 Share Posted October 18, 2011 .josh, I understand that it may require digging... I pretty much mean check the javascript to see where the content it coming from. Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280242 Share on other sites More sharing options...
adv Posted October 19, 2011 Author Share Posted October 19, 2011 how do i check it ? how do i sent the content ? Quote Link to comment https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280460 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.