Use curl_setopt ($ch, CURLOPT_RETURNTRANFER, 1), but still output the page

Code
$url = "http://www.baidu.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch); // 
curl_close($ch);
var_dump($response);

clipboard.png

clipboard.png

the ideal result is to output HTML element tags;
Php
Mar.18,2021

? Didn't you output it yourself


var_dump (htmlentities ($response));

convert characters to HTML escape characters

otherwise the characters you get will be parsed by the browser.

htmlentities

Menu