I have the following:
example.com/video.php?player=https://c6d34z8w3zavhqt3.ezcdn483.net:8443/hls/dcgmsy35q.m3u8?s=qm3aTTYK9EvvG8aHlbOGMg&e=1614565195
I want to get the values contained player
in , using the method $_GET
as follows:
$url = $_GET['player'];
I will get only the following result:
https://c6d34z8w3zavhqt3.ezcdn483.net:8443/hls/dcgmsy35q.m3u8?s=qm3aTTYK9EvvG8aHlbOGMg
While this other one I will not be able to have, because it will be separated through this&
&e=1614565195
So, since I can fully get this value, no matter what parameters the URL has, what I want is to get everything I start from player=
:
https://c6d34z8w3zavhqt3.ezcdn483.net:8443/hls/dcgmsy35q.m3u8?s=qm3aTTYK9EvvG8aHlbOGMg&e=1614565195
You could use
parse_url
andparse_str
to get the values from the url separately, you put those values in a variable and then display as needed, eg.You could get it by combining the following PHP functions:
substr()
: Which returns part of a string.strpos()
: Which finds the position of the first occurrence of a substring in a stringstrlen()
: Which gets the length of a string.For example:
Departure:
You could also use
explode()
. Since this function creates an array using the data that you indicate in the second parameter as a separator, it could be interesting if you also want to retrieve the valuevideo.php
.Departure: