darkwolf Posted June 23, 2007 Share Posted June 23, 2007 If I sent 'www.darkwolf.ca/index.php?go=http://youtube.com/watch?v=MbILp2gRsEI&mode=related&search=' to my browser. How would we put the v=MbILp2gRsE into a vairable of $v; <? $go = $_REQUEST['go']; strstr ($go, $); //what the **** do I do?? ?> Link to comment https://forums.phpfreaks.com/topic/56799-solved-extracting-a-urlvariable-from-string/ Share on other sites More sharing options...
darkwolf Posted June 23, 2007 Author Share Posted June 23, 2007 bump? Link to comment https://forums.phpfreaks.com/topic/56799-solved-extracting-a-urlvariable-from-string/#findComment-280984 Share on other sites More sharing options...
chocopi Posted June 23, 2007 Share Posted June 23, 2007 i think you could do $v = $_GET['v']; echo $v; ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/56799-solved-extracting-a-urlvariable-from-string/#findComment-280986 Share on other sites More sharing options...
chigley Posted June 23, 2007 Share Posted June 23, 2007 <?php $go = $_GET["go"]; $query = parse_url($go, PHP_URL_QUERY); parse_str($query, $result); $v = $result["v"]; echo $v; ?> Link to comment https://forums.phpfreaks.com/topic/56799-solved-extracting-a-urlvariable-from-string/#findComment-280989 Share on other sites More sharing options...
darkwolf Posted June 24, 2007 Author Share Posted June 24, 2007 i think you could do $v = $_GET['v']; echo $v; ~ Chocopi Uhhh... thats just echo $_GET['v']..... there is none set? Thats not helpful...... .... <?php $go = $_GET["go"]; $query = parse_url($go, PHP_URL_QUERY); parse_str($query, $result); $v = $result["v"]; echo $v; ?> Sorry but that errors... I modified your method just a bit different and go it to work. Thanks very much. Heres the code if anyone needs <? $query=parse_url($go); parse_str($query[query], $result); echo $result['v']; ?> YAY! Link to comment https://forums.phpfreaks.com/topic/56799-solved-extracting-a-urlvariable-from-string/#findComment-281138 Share on other sites More sharing options...
chigley Posted June 24, 2007 Share Posted June 24, 2007 Never errored when I tested it Ah well, working now Link to comment https://forums.phpfreaks.com/topic/56799-solved-extracting-a-urlvariable-from-string/#findComment-281213 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.