Home > Blockchain >  how get reponse body html with curl
how get reponse body html with curl

Time:04-05

I use a curl script to send information from a form. This form redirects to another page to validate the information. I would like to retrieve the body of the page where the processing must be validated

Currently, i see the page display, but just idk how get this html...

my curl :

$url = "https://www.website.com/porte_transferer.php";


//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $valueRessource);
curl_setopt(
    $ch,
    CURLOPT_USERAGENT,
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,10);

$result = curl_exec($ch);


with that i see the page, but idk what add for take this html

Thank you man

CodePudding user response:

you can use htmlentities($result); to get the row returned html , and , for printing it echo htmlentities($result);

CodePudding user response:

you should follow redirects... I bet a fiver that the site sends you a 30x status and some location to follow

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

CodePudding user response:

anyone have a idea for my problem ?

  • Related