-1

I created this function to fetch the contents of a url with curl

function leggiUrl($url){
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    $content = curl_exec($ch);
    curl_close($ch);
    return $content;
}

if I enter a URL whose content is partly generated by a script JavaScript, this text is taken from the function. I would like to grab the text (finished) of any page. Thank you.

iacoposk8
  • 11
  • 6

2 Answers2

0

You can't. cURL retrieves the HTML page but doesn't parse it

0

You will have to perform your own analysis on what happens when the page is loaded and from where it grabs all the content. I wish you the best of luck.

silkfire
  • 24,585
  • 15
  • 82
  • 105