我想获得
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
但是我得到
<!DOCTYPE html>
<html lang="en" id="facebook" class="no_js">
在使用curl从下面的代码中获得php中的HTTP响应体之后
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://www.facebook.com/');
$file=fopen("/var/www/myapp/welcome.txt","w+");
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch,CURLOPT_COOKIE,"PHPSESSID=5b1sXXXXo5niv5p0t24ntbh56X;fusion_user=13XXX.cXXX282138afbe9066b8be1cb426841d");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5");
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FILE, $file);
$retValue = curl_exec($ch);
fclose($file);
curl_close($ch);
Facebook使用HTML5 Doctype-这只是<!DOCTYPE html>
-您可以在Facebook.com 的源代码中看到这一点
将http://www.facebook.com/
更改为具有所需Doctype的页面的URL。
Facebook使用您获得的Doctype。