You should most likely be using:
[manual]file_get_contents/manual
Then, search for a string. Here's a small class I wrote to get the Department of Homeland Security Threat Level and output a stupid page.
<?php
class Advisory
{
var $txtcolor;
var $bgcolor;
var $level;
var $contents;
function level_switch($level)
{
switch($level)
{
case 'SEVERE':
$this->bgcolor = '#FF0000';
$this->txtcolor = '#FFFFFF';
break;
case 'HIGH':
$this->bgcolor = '#FF9900';
$this->txtcolor = '#000000';
break;
case 'ELEVATED':
$this->bgcolor = '#FFFF00';
$this->txtcolor = '#000000';
break;
case 'GUARDED':
$this->bgcolor = '#669900';
$this->txtcolor = '#000000';
break;
case 'LOW':
$this->bgcolor = '#009900';
$this->txtcolor = '#000000';
break;
}
$page = '<html>
<head>
<title>Threat Level: '.$this->level.'</title>
</head>
<body bgcolor="'.$this->bgcolor.'">
<font color="'.$this->txtcolor.'">The current U.S. Security Threat Level is:<br>
<b>'.$this->level.'</b></font>
</body>
</html>';
return $page;
}
function getAdvisory()
{
$this->contents = @file_get_contents("http://www.dhs.gov/dhspublic/getAdvisoryCondition");
if(!$this->contents)
{
return "Unable to Connect!";
}
else
{
$this->contents = explode("\n", $this->contents);
$this->contents = $this->contents[1];
$this->level = strstr($this->contents, '="');
$this->level = substr($this->level, 2, -5);
return $this->level;
}
}
}
$advisory =& new Advisory;
$level = $advisory->getAdvisory();
echo $advisory->level_switch($level);
?>
Viewable Here
Don't mind the deprecated HTML and sloppy HTML code. I threw it together as a test to see if I could get what I wanted. When I go to implement it, I will clean it up.
Basically, this script reads the source of http://www.dhs.gov/dhspublic/getAdvisoryCondition and returns it in a variable. From there I break it down into workable parts. I remove the opening xml tag with the explode and select only the line I need. Then I select only from the "=" sign and over, and trim it to get just the text between the =" and the " />". Then I use that to run through a quick switch() that sets the background & text. Once that's done, it's all over, and I output it.
You can view a more workable example here (top right corner of site): v2 of a Test Site
~Brett