<html>
<head>
<style>
BODY {
font-family:Courier New, monospace;
font-size: 11pt; 
font-weight: bold}
</style>
</head>
<body><div class='slug'><?php
</div><div class='byline'>
</div><p /><div>//http://ca3.php.net/eregi_replace<br /> function highlight($x,$var) {<br /> $var = explode(&quot; &quot;,$var);<br /> <br /> for($j=0; $j&lt; count($var); $j++){ <br /> $xtemp = &quot;&quot;;<br /> $i=0;<br /> while($i&lt;strlen($x)){<br /> if((($i + strlen($var[$j])) &lt;= strlen($x)) &amp;&amp; (strcasecmp($var[$j], substr($x, $i, strlen($var[$j]))) == 0)) {<br /> $xtemp .= &quot;&lt;b style='color:red'&gt;&quot; . substr($x, $i , strlen($var[$j])) . &quot;&lt;/b&gt;&quot;;<br /> $i += strlen($var[$j]);<br /> }<br /> else {<br /> $xtemp .= $x{$i};<br /> $i++;<br /> }<br /> }<br /> $x = $xtemp;<br /> }<br /> return $x;<br /> }<br /> <br /> function get_content($url)<br /> {<br /> $ch = curl_init();<br /> <br /> curl_setopt ($ch, CURLOPT_URL, $url);<br /> curl_setopt ($ch, CURLOPT_HEADER, 0);<br /> curl_setopt($ch, CURLOPT_FAILONERROR, 0); <br /> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); <br /> curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)');<br /> curl_setopt($ch, CURLOPT_TIMEOUT, 5); //times out after 4s <br /> if(preg_match('/^https:\/\//sim',$url)==true) {<br /> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);<br /> curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);<br /> }<br /> ob_start();<br /> <br /> curl_exec ($ch);<br /> curl_close ($ch);<br /> $string = ob_get_contents();<br /> <br /> ob_end_clean();<br /> <br /> return $string; <br /> }<br /> <br /> function processPage($url) {<br /> $pagehtml=''; <br /> $outputHTML='';<br /> if($url) {<br /> $pagehtml=get_content($url);<br /> if($pagehtml) {<br /> if (eregi(&quot;&lt;title&gt;(.*)&lt;/title&gt;&quot;, $pagehtml, $title)) {<br /> $page_title = $title[1];<br /> $is_title = true;<br /> } <br /> $outputHTML.= '&lt;tr&gt;&lt;td valign=top&gt;&lt;b&gt;url:&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;'. $_GET['url']. '&quot;&gt;' .$_GET['url'].'&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';<br /> <br /> $outputHTML.= '&lt;tr&gt;&lt;td valign=top&gt;&lt;b&gt;title:&lt;/b&gt;&lt;/td&gt;&lt;td&gt;'.$page_title.'&lt;/td&gt;&lt;/tr&gt;';<br /> <br /> preg_match_all('/&lt;meta(.*?)&gt;/sim',$pagehtml,$metaarray);<br /> for($tmploop=0;$tmploop&lt;count($metaarray[0]);$tmploop++) {<br /> <br /> preg_match('/name=(\'|&quot;)(.*?)(\'|&quot;)/sim',$metaarray[1][$tmploop],$namearray);<br /> preg_match('/content=(\'|&quot;)(.*?)(\'|&quot;)/sim',$metaarray[1][$tmploop],$contentarray);<br /> <br /> $namearray[2] = ltrim($namearray[2]);<br /> $contentarray[2] = ltrim($contentarray[2]);<br /> <br /> <br /> if( ($namearray[2] &amp;&amp; $contentarray[2]) &amp;&amp; isset($namearray[2]) ) {<br /> $outputHTML.='&lt;tr&gt;';<br /> $outputHTML.='&lt;td nowrap valign=top&gt;&lt;b&gt;' . $namearray[2] . ':&lt;/b&gt;&lt;/td&gt;' . '&lt;td width=200 valign=top&gt;' .$contentarray[2] . '&lt;/td&gt;';<br /> $outputHTML.='&lt;/tr&gt;';<br /> }<br /> <br /> }<br /> } else {<br /> $outputHTML='URL can not be found!';<br /> }<br /> <br /> } else {<br /> $outputHTML='Invalid URL!';<br /> }<br /> <br /> <br /> echo '&lt;strong&gt;URL, TITLE &amp; META&lt;/strong&gt;&lt;br&gt;&lt;hr&gt;';<br /> echo '&lt;table&gt;';<br /> echo highlight($outputHTML, $_GET[&quot;keyword&quot;]); <br /> echo '&lt;/table&gt;&lt;br&gt;';<br /> <br /> echo '&lt;strong&gt;PAGE COPY TEXT&lt;/strong&gt;&lt;br&gt;&lt;hr&gt;';<br /> <br /> preg_match(&quot;/&lt;body[^&gt;]*&gt;(.*)&lt;\/body&gt;/siU&quot;, $pagehtml, $pageCopyArray);<br /> <br /> $finalText = eregi_replace(&quot;&lt;script[^&gt;]*&gt;&quot;, &quot;&quot;, $pageCopyArray[0]);<br /> $finalText = eregi_replace(&quot;&lt;style[^&gt;]*&gt;&quot;, &quot;&quot;, $finalText);<br /> <br /> <br /> echo '&lt;div&gt;'.highlight(strip_tags($finalText),$_GET[&quot;keyword&quot;]).'&lt;/div&gt;'; <br /> <br /> } <br /> processPage($_GET[url]); <br /> ?&gt;<br /> <br /> <br /> <br /> </div></body>
</html>