I have a problem with my curl :
I connect to a page with CURL. then I redirect myself to a page that is available when you are connected. and then I would like to retrieve information on this page. But how can I do to get the html code? I have the page that is displayed, but I can't get the source code for scrap
$url = "https://www.mywebsite.com/porte_transferer.php";
curl_setopt ($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
return true with var dump
with that, i see the page, but idk how recover html for scrap my information
Thank for your help
CodePudding user response:
$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
if(curl_error($ch)) {
fwrite($fp, curl_error($ch));
}
curl_close($ch);
fclose($fp);