File: /var/www/wordpress/wp-content/locastatus.php
<?php
function HomepageLaden($url, $postdata)
{
$agent = "Mozilla/4.0";
$header[] = "Accept: text/vnd.wap.wml,*.*";
$ch = curl_init($url);
if ($ch)
{
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
# mit den nächsten 2 Zeilen könnte man auch Cookies
# verwenden und in einem DIR speichern
#curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
#curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
if (isset($postdata))
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
}
$tmp = curl_exec ($ch);
curl_close ($ch);
}
return $tmp;
}
$_url = "https://locatoweb.com/map/single/1123322609";
//echo $_url;
echo "<br>";
$_buffer = HomepageLaden($_url, "");
//echo $_buffer;
$_elementid = "ltrStatus0";
$dom = new DOMDocument();
@$dom->loadHTML($_buffer);
foreach($dom->getElementById($_elementid) as $element) {
echo $element->nodeValue;
}
$fd = fopen ($_url, "r");
while (!feof($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose ($fd);
//echo "TEST";
?>