Jump to content

curl question


adv

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/249276-curl-question/
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/249276-curl-question/#findComment-1280178
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.