I want to break down this URL into variables.
http://example.com/user.php?u=38456
I want the value after u=; for example, 38456 or 36491 or some other humeric value.
When I get that value I will put that here:
$url = /* that value */;
function gameStats($url)
{
$result = file_get_contents('http://www.popre.net/game.php?u='.$url.'');
$expl = explode('"',$result);
print_r($expl);
}
gameStats($url);
If I put the URL value in there, it will give me arrays that I will use to show game reports.
You’re looking for
parse_url()andparse_str(). Something like this should work:You can see it working in this demo.
To get it in the function, pass it as a parameter and concatenate it within the string: