Answer the question
In order to leave comments, you need to log in
How to get the doctype of a page from a link?
I insert a site into an iFrame and you need to first find out the doctype of this site in a variable in order to later check with jQuery tools for the presence of a ban on displaying in
a frame.
Well, after picking the question for a long time, I came across a solution, keep the php script
$error=false;
$urlhere='http://facebook.com';
$ch = curl_init();
$options = array(
CURLOPT_URL => $urlhere,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch);
$headers=substr($response, 0, $httpCode['header_size']);
$headersDown = mb_strtolower($headers);
if(strpos($headersDown, 'X-Frame-Options: deny')>-1||strpos($headersDown, 'X-Frame-Options: SAMEORIGIN')>-1) {
$error=true;
}
$httpcode= curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo json_encode(array($error));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question