Re: Curl output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gbhumphrey wrote:
Hi, I am doing a basical curl call and can get the webpage I want. However
when it prints to the screen, it only prints the text, not css or any
javascript calls that run on page load.
Is there a way to make it do that?

thanks
using a basic curl call
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,0); // return into a variable
curl_exec($curl_handle);






Along the lines of what Paul has already alluded to, you will probably find upon further examination of the html source that the "linked" files (js, css, etc...) are probably using relative paths, not absolute paths including the domain name.

To fix this, you would have to do a little source code rewriting to add the full domain name and directory path information to the "linked" in url structure.

I know if you do this with wget (cli app) that you can have it re-write the domain + path url references. But, I'm not sure if cURL has an option for that. You might RTM on the cURL options page to find out.

http://php.net/curl


--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux