timelf123
Apr 9th 2007, 3:20 pm
Trying to get a more dynamic signature generator built for a forum based off of IPB, here is some of the code:
Code:
<?php
function GetUserInfo($ProfileURL){
$pagecontent = file_get_contents($ProfileURL);
$start = strpos($pagecontent, "class='pp-name'")+17;
$end = strpos($pagecontent, "</font> | <a",$start);
$pagecontent = substr($pagecontent, $start, $end-$start);
$start = strpos($pagecontent, "<h3")+27;
$pagecontent = substr($pagecontent, $start, strlen($pagecontent));
$pagecontent = str_replace("<font color=\"green\">TR: ","",$pagecontent);
$pagecontent = str_replace(" (","|",$pagecontent);
$iArray = explode("|",$pagecontent);
return $iArray;
}
$pronumber = $_POST["pronumber"];
//$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser=16501");
$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser='$pronumber'");
echo $userinfo[0] . "<br>";
echo $userinfo[1];
?>
new to php, the
//$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser=16501"); line works,
but
$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser='$pronumber'");
returns plaintext html garbage, instead of stripping the page down and returning
timelf123
6
What is wrong with my syntax?
Tim
Code:
<?php
function GetUserInfo($ProfileURL){
$pagecontent = file_get_contents($ProfileURL);
$start = strpos($pagecontent, "class='pp-name'")+17;
$end = strpos($pagecontent, "</font> | <a",$start);
$pagecontent = substr($pagecontent, $start, $end-$start);
$start = strpos($pagecontent, "<h3")+27;
$pagecontent = substr($pagecontent, $start, strlen($pagecontent));
$pagecontent = str_replace("<font color=\"green\">TR: ","",$pagecontent);
$pagecontent = str_replace(" (","|",$pagecontent);
$iArray = explode("|",$pagecontent);
return $iArray;
}
$pronumber = $_POST["pronumber"];
//$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser=16501");
$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser='$pronumber'");
echo $userinfo[0] . "<br>";
echo $userinfo[1];
?>
new to php, the
//$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser=16501"); line works,
but
$userinfo = GetUserInfo("http://www.anything4free.com/forums/index.php?showuser='$pronumber'");
returns plaintext html garbage, instead of stripping the page down and returning
timelf123
6
What is wrong with my syntax?
Tim