I have a HTML form field $_POST["url"]
having some URL strings as the value.
Example values are:
https://example.com/test/1234?email=xyz@test.com https://example.com/test/1234?basic=2&email=xyz2@test.com https://example.com/test/1234?email=xyz3@test.com https://example.com/test/1234?email=xyz4@test.com&testin=123 https://example.com/test/the-page-here/1234?someurl=key&email=xyz5@test.com
etc.
How can I get only the email
parameter from these URLs/values?
Please note that I am not getting these strings from browser address bar.
I created function from @Ruel answer. You can use this:
Example:
Thanks to @Ruel
All the parameters after
?
can be accessed using$_GET
array. So,will extract the emails from urls.
To get parameters from URL string, I used following function.
If there are many URL strings, then you can use loop to get parameter 'email' from all those URL strings and store them in array.
You could get the parameters of the url like this:
.. or like this:
Examples of the path to file:
if the url looks like this:
then the path to file is: