Retrieving Contents of a site. [Solved]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

anthony88guy
Forum Contributor
Posts: 246
Joined: Thu Jan 20, 2005 8:22 pm

Post by anthony88guy »

Code: Select all

<?php
$f = "http://www.kingsofchaos.com/stats.php?id=654760";
$site = file_get_contents($f);

$found = preg_match ('#<td><b>Army size:</b></td>[\n\s]*<td>([\d,]*?)</td>#', $site, $match);
if ($found){
    echo 'Army size: '.$match[0];
}else{
    echo 'No matches.';
}

?>
It returns no matches. I've searched google for regex, but where would be a good tutorial or site that could help me out. This regex stuff is pretty foreign to me.
Post Reply