R
E
S
O
U
R
C
E
S
       Home      Products & Services      Contact Us      Links


WebHatchers will design & develop your site for you.
_______________________

Website Menu Heaven: menus, buttons, etc.
_______________________

Send us your questions.
_______________________

site search by freefind
_______________________

HOME
SEO, Google, Privacy
   and Anonymity
Browser Insanity
JavaScript
Popups and Tooltips
Free Website Search
HTML Form Creator
Animation
Buttons and Menus
Counters
Captchas
Image Uploading
CSS and HTML
PHP
AJAX
XPATH
Website Poll
IM and Texting
Databases—MySQL
   or Not MySQL
Personal Status Boards
Content Management
   Systems
Article Content
   Management Systems
Website Directory
   CMS Systems
Photo Gallery CMS
Forum CMS
Blog CMS
Customer Records
   Management CMS
Address Book CMS
Private Messaging CMS
Chat Room CMS
JavaScript Charts
   and Graphs




Free Personal Status Boards (PSB™)

Free Standard Free PSB

Free PSB Pro Version

Free Social PSB

Free Social PSB Plus (with Email)

Free Business PSB

Free Business PSB Plus (with Email)

PSB demo

Social PSB demo

Business PSB demo

So what's all this PSB stuff about?

Chart comparing business status boards

PSB hosting diagram

PSB Licence Agreement



Copyright © 2002 -
MCS Investments, Inc. sitemap

PSBs, social networking, social evolution, microcommunities, personal status boards
PSBs, social networking, business personal status boards
website design, ecommerce solutions
website menus, buttons, image rotators
Ez-Architect, home design software
the magic carpet and the cement wall, children's adventure book
the squirrel valley railroad, model railroad videos, model train dvds
the deep rock railroad, model railroad videos, model train dvds

PHP Based Test of Getting Website Info Dynamically

To learn the most from these 6 test pages, first test each of the test scripts below, and then read the Info on each of these tests.



There are a few cool PHP functions that are a great help in getting website info dynamically: preg_match() to filter retrieved content to separate what's needed and what's not, get_meta_tags() to get the metatags, and file_get_contents() to retrieve web page content. The scenario goes like this: We set up a list of URLs presented as links (although the action of hovering over a link, not clicking it, is the only one we are interested in here). Then we set up an empty DIV whose ID is 'k' and whose CSS style class vacillates between .d and .e but the only difference between the 2 is that .d has background color and a border while .e has no border and its background is transparent. This DIV is where info gotten from websites will be stuck. There is no set height—it will vary according to the info found. We have to start with an empty DIV so we use sessions to set the f flag to 0. When the PHP script on the page finds f=0, it sets the DIV's class to 'e' which makes the DIV invisible.

The script uses JavaScript to constantly check the mouse cursor coordinates. The getCoords() function not only keeps checking these coordinates, it also compares the cursor position to the actual position of the website links on the page. The links are given 32 pixels each, vertically, and this works much better than mouseover, which tends to fail. When the cursor is on a link, the parameter detection script in getCoords() reloads the page but adds query strings. The string contains the URL, the f flag, and the y coordinate at which the link was hovered over by the cursor, which will also be the y coordinate of the info box DIV with the ID of 'k'. All these are picked up by the PHP $_GET[] functions and if f=0 the DIV's class is turned into .e, while it f=1, the URL will be checked out for info and that will go into the DIV box. If the URL is slow loading, the info box will be too, but if it's fast, the box will be fast too.

In the PHP script, if a title is found in the website file's contents, it gets printed out on the screen in bold via echo. If a description is found in the metatags, it gets printed out on the screen via echo. If characters are encoded and this is detected via mb_detect_encoding(), utf8_decode() decodes them. If htmlentities are found, get_html_translation_table(HTML_ENTITIES) and html_entity_decode() decodes them. Finally, the file contents are parsed for paragraph tags and sentences in the paragraphs—defined by ending with a period—and these results are echoed into the DIV box display. After ten results, the script stops looking and it's done.

Note that the final HTML code below is the displaying of the links themselves. This test page worked to prove that getting website info dynamically—on the fly—is viable. If this was a regular website directory, it would of course be using MySQL databases and other elements of the CMS configuration protocol, not a few sample links. But it would also have to address the issue of page reload fllicker, which is unacceptably disconcerting. This will be done, with complete success, in the final few test pages in this 6-test series. Have faith—we've got your back.

<?php
session_start();
$_SESSION['flag'] = "0";
if(!isset($f)){$f="0";}
?>

<html>
<head>
<style type="text/css">
BODY {margin-left:0; margin-right:0; margin-top:0;text-align:left}
p, li {font:13px Verdana; color:black;text-align:left;margin-top:0.2em;margin-bottom:0}
h1 {font:bold 28px Verdana; color:black;text-align:center}
h2 {font:bold 24px Verdana;text-align:center}
.d {position:absolute; left:700px; width:300px; margin:0; padding:10px; background-color:#ddd; border:1px solid #000; font: 11px Verdana;}
.e {position:absolute; left:700px; width:300px; margin:0; padding:10px; background-color:transparent; border:none; font: 11px Verdana;}
.f {position:absolute; left:330px; width:350px; top:70px; padding:10px; background-color:#eee; border:1px solid black; font: 13px Verdana;}
.b {font:bold 13px Verdana;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--

var f = <?php echo $f; ?>;

function meta(){e=document.getElementById('k');e.style.display='none';}

var q = 0;
var yy = 0;
var x = 0;
var y = 0;
var url='';

var urls=new Array("http://www.theliquidateher.com/","http://www.css-resources.com/",
"http://www.mcsii.biz/","http://www.aglasshalffull.org/",
"http://www.bicycleclothing.com/","http://fireprotection.name/",
"http://www.criegergoodwin.com/","http://4homedesign.wordpress.com/",
"http://www.aglasshalffull.org/webhatchers/webhatchers.html",
"http://theliquidateher.com/squirrel-valley/squirrel-valley-railroad-demo.htm");

mactest=(navigator.userAgent.indexOf("Mac")!=-1) //My browser sniffers
Netscape=(navigator.appName.indexOf("Netscape") != -1)
msafari=(navigator.userAgent.indexOf("Safari")!= -1)
wsafari=0; if(!mactest&&msafari){wsafari=1;msafari=0}
is_opera = 0; if(window.opera){is_opera=1}
is_ie_mac = 0; is_ie=0;if(document.all){is_ie=1}
if(is_ie&&mactest){is_ie_mac=1}

function startmouse() {if(Netscape) {document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove=getCoords;}

function getCoords(e){
if (!e) var e = window.event;
if (e.pageX){x = e.pageX;y = e.pageY;}
else if (e.clientX){x = e.clientX + document.body.scrollLeft;y = e.clientY + document.body.scrollTop;}
if (y<115&&y>85){yy=y;q=0;}else{q=parseInt((y-80)/32);yy=y-q*32;}
if (y>400){return;}
if (x<670&&x>340&&yy>85&&yy<100&&f==0){f=1;window.location='test1.php?url='+urls[q]+'&f=1&y='+(y-20);}
if ((x>670||x<340||yy<85||yy>100)&&f==1){f=0;meta();window.location='test1.php?url=0&f=0&y='+(y-20);}
}

// -->
</script>
</head>
<body onLoad="startmouse()">

<?php

$f = $_GET['f'];
$y = $_GET['y'];if($f=="0"){$_SESSION['flag'] = "0";echo "<div id='k' class='e' style='top:".$y."px'>";}
$url = $_GET['url'];
if(isset($y)){
if($f=="1" && $_SESSION['flag'] == "0"){ $f="2"; $_SESSION['flag'] = "1";

echo "<div id='k' class='d' style='top:".$y."px'>";
$t = file_get_contents($url);
preg_match('/<title>([^>]*)<\/title>/si',($t), $m);
echo "<span class='b'>"; echo $m[1]; echo "<BR></span>";
$a = get_meta_tags($url);$d=$a['description'];
if(mb_detect_encoding($d, 'UTF-8, ISO-8859-1', true) != 'ISO-8859-1'){$d = utf8_decode($d);}
$d = strtr($d, get_html_translation_table(HTML_ENTITIES));
echo $d; echo "<BR>";$o = html_entity_decode($t);$w = array();
preg_match_all("|<[^>]+>(.*)</[^>]+>|", $o, $v, PREG_PATTERN_ORDER);
for ($x = 0; $x < 10; $x++) {
if (preg_match('<p>i', $v[0][$x])) {$g = strip_tags($v[0][$x]);
if (preg_match("/\./", $g)){$w[] = $g;}}
if (isset($w[0])){preg_match("/([^.]+.)/", $g,$e);
$z=$e[1]; echo $z;}}

echo "</div>";}}

?>
</div>

<div class='f'>

<a HREF="http://www.theliquidateher.com/" target="_blank">http://www.theliquidateher.com</a>

<BR><BR><a HREF="http://www.css-resources.com/" target="_blank">http://www.css-resources.com</a>

<BR><BR><a HREF="http://www.mcsii.biz/" target="_blank">http://www.mcsii.biz</a>

<BR><BR><a HREF="http://www.aglasshalffull.org/" target="_blank">http://www.aglasshalffull.org</a>

<BR><BR><a HREF="http://www.bicycleclothing.com/" target="_blank">http://www.bicycleclothing.com</a>

<BR><BR><a HREF="http://fireprotection.name/" target="_blank">http://fireprotection.name</a>

<BR><BR><a HREF="http://www.criegergoodwin.com/" target="_blank">http://www.criegergoodwin.com</a>

<BR><BR><a HREF="http://4homedesign.wordpress.com/" target="_blank">http://4homedesign.wordpress.com</a>

<BR><BR><a HREF="http://www.aglasshalffull.org/webhatchers/webhatchers.html" target="_blank">http://www.aglasshalffull.org/webhatchers/webhatchers.html</a>

<BR><BR><a HREF="http://theliquidateher.com/squirrel-valley/squirrel-valley-railroad-demo.htm" target="_blank">http://theliquidateher.com/squirrel-valley/squirrel-valley-railroad-demo.htm</a>

</div>
</body>
</html>