Rumah > Soal Jawab > teks badan
P粉7138664252023-08-07 11:27:20
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER,true); $result = curl_exec($ch); curl_close($ch); list($headers, $content) = explode("\r\n\r\n",$result,2); // Print header foreach (explode("\r\n",$headers) as $hdr) printf('<p>Header: %s</p>', $hdr); // Print Content echo $content;