This question already has an answer here:
- Getting vars from URL 6 answers
Ok, so I have a string like so:
index.php?page=test2;sa=blah
And I need only to grab what gets returned using $_GET['page']
, so it will return, test2
in this case. BUT page MUST be defined DIRECTLY after index.php?
before it can return an actual string. How do I do this? I just need the same results returned from a $_GET for the page variable. I can also have just this:
index.php?page=blah
Should return blah
or this:
index.php?page=anything&sa=blah
Returns anything
or this:
index.php?action=blah;page=2
Returns empty string, cause this is NOT directly after index.php?
or basically any url, but it needs to grab the variable of page if it exists, only after index.php?
. And sometimes page might not even exist at all, in this case, an empty string should be returned.
How can I do this? I am not browsing to the URL in my browser, so, don't think $_GET will work, but it needs to simulate and return the EXACT same results that $_GET will return in the browser, but only if page
is defined directly after index.php?
</div>