Regular expressions never were my strong point, and they never will be.
My hosting account has cPanel installed (you don't have to know what that is to help me), and one of the pages in cPanel tells you the server status. I'm trying to have a PHP script go in, grab the server load off of the page, and then do some stuff with it. Whenever I test it, though, it prints back the entire page. I'm guessing that it's not finding the pattern, and therefore it's not replacing it.
Can anyone figure out why my regular expression isn't working? It's probably something very simple that I'm just overlooking, but I can't find it at all. Here's the line in the HTML source that I'm trying to match:
<tr><td>Server Load</td><td>0.26 (4 cpus)</td>
And here's my PHP:
$contents = file_get_contents($URL);
$load = preg_replace("/^.+Server Load<\\/td><td>(\\d+\\.\\d+).+$/","$1",$contents,1);
echo $load;
What's the problem with it? Thanks in advance.