@ 2014-04-09T18:07:51Z <?php
$url = "http://blog.everymansoftware.com/2011/11/development-setup-for-neo4j-and-php_05.html";
$fileHeaders = @get_headers($url);
if( $fileHeaders[0] == "HTTP/1.1 200 OK" || $fileHeaders[0] == "HTTP/1.0 200 OK")
{
$content = strip_html_tags(file_url_contents($url));
}
//To fetch the $url by using cURL
function file_url_contents($url){
$crl = curl_init();
$timeout = 30;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
} //file_url_contents ENDS
//To remove all the hidden text not displayed on a webpage
function strip_html_tags($str){
$str = preg_replace('/(<|>)\1{2}/is', '', $str);
$str = preg_replace(
array(// Remove invisible content
'@<head[^>]*?>.*?</head>@siu',
'@<style[^>]*?>.*?</style>@siu',
'@<script[^>]*?.*?</script>@siu',
'@<noscript[^>]*?.*?</noscript>@siu',
),
"", //replace above with nothing
$str );
$str = replaceWhitespace($str);
$str = strip_tags($str);
return $str;
} //function strip_html_tags ENDS
//To replace all types of whitespace with a single space
function replaceWhitespace($str) {
$result = $str;
foreach (array(
" ", " \t", " \r", " \n",
"\t\t", "\t ", "\t\r", "\t\n",
"\r\r", "\r ", "\r\t", "\r\n",
"\n\n", "\n ", "\n\t", "\n\r",
) as $replacement) {
$result = str_replace($replacement, $replacement[0], $result);
}
return $str !== $result ? replaceWhitespace($result) : $result;
}
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.3.0 - 8.3.6 Warning: Trying to access array offset on false in /in/36DA4 on line 4
Warning: Trying to access array offset on false in /in/36DA4 on line 4
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 Warning: Trying to access array offset on value of type bool in /in/36DA4 on line 4
Warning: Trying to access array offset on value of type bool in /in/36DA4 on line 4
Output for 7.4.0 - 7.4.33 Notice: Trying to access array offset on value of type bool in /in/36DA4 on line 4
Notice: Trying to access array offset on value of type bool in /in/36DA4 on line 4
Output for 4.3.0 - 4.3.1 , 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.10 , 7.2.0 - 7.2.33 , 7.3.12 - 7.3.33 Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 Process exited with code 255 . preferences:dark mode live preview
229.91 ms | 401 KiB | 313 Q