UrbanTwitch
08-22-2009, 09:00 PM
I am trying to get some information using a parser I am making.
Here is my code
<?php
if (!$_GET['id']) {
die("Please specify a member ID using ?id=<u>1245</u>");
}
$file = file_get_contents("http://zbcode.com/profile/".$_GET['id']);
if (preg_match("/<td>No Member was found/",$file) == 1) die("Member not Found");
preg_match("/<th colspan=\"2\" class=\"l\">(.*?)<\/th>/",$file,$name);
preg_match("/<dt>Posts:<\/dt><dd>(.*?)<\/dd>/",$file,$post);
echo ("Hi $name[1] <br />$post[1]");
?>
However when I run it.. I get :
Notice: Undefined offset: 1 in C:\wamp\www\wekaboard\zbcode.php on line 9
Hi Dorith
Here is what I am trying to get:
<dt>Posts:</dt>
<dd>527</dd>
Where 527 is the number I am getting. Of course, It updates.
Example profile: http://zbcode.com/profile/375164
What am I doing wrong?
Here is my code
<?php
if (!$_GET['id']) {
die("Please specify a member ID using ?id=<u>1245</u>");
}
$file = file_get_contents("http://zbcode.com/profile/".$_GET['id']);
if (preg_match("/<td>No Member was found/",$file) == 1) die("Member not Found");
preg_match("/<th colspan=\"2\" class=\"l\">(.*?)<\/th>/",$file,$name);
preg_match("/<dt>Posts:<\/dt><dd>(.*?)<\/dd>/",$file,$post);
echo ("Hi $name[1] <br />$post[1]");
?>
However when I run it.. I get :
Notice: Undefined offset: 1 in C:\wamp\www\wekaboard\zbcode.php on line 9
Hi Dorith
Here is what I am trying to get:
<dt>Posts:</dt>
<dd>527</dd>
Where 527 is the number I am getting. Of course, It updates.
Example profile: http://zbcode.com/profile/375164
What am I doing wrong?