I'm in a predicament here.
Say I wanted to take info from this forum (http://phpbuilder.com/board), such as the current username that is logged in, and echo it.
This is what I tried:
<?
function getBetween($str, $start, $end) {
$startlen = strlen($start);
if (($startpos = strpos($str, $start)) !== false
&& ($endpos = strpos($str, $end)) !== false
&& ($skip = $startpos + $startlen) <= $endpos) {
return substr($str, $skip, $endpos - $skip);
} else {
return false;
}
}
$html = file_get_contents('http://phpbuilder.com/board');
$str = htmlspecialchars($html);
$start = "Welcome, ";
$end = ".<";
$result = getBetween($str, $start, $end);
echo $str;
?>
You can probably see what this code does. The problem is, that when it gets the file contents [file_get_contents()], it would not show the name. I tried echoing the HTML only, by changing echo $str; to echo $html;. It did in fact echo all the page HTML contents, but it showed the HTML as if I was not logged in, thus not showing "Welcome, MHeys."
Can anyone help me?