Shu Posted December 20, 2006 Share Posted December 20, 2006 alright i want to get the vars from a urlthe url will be generated at run-time, not the user requested urleg<?$url = "http://example.com/thisisaexample.php?abc=thisisabc&def=thisisdef";?>then how do i make my script to understand abc = thisisabc? Link to comment https://forums.phpfreaks.com/topic/31384-solved-get-vars-from-url/ Share on other sites More sharing options...
Orio Posted December 20, 2006 Share Posted December 20, 2006 [code]echo $_GET['abc']; //output- thisisabcecho $_GET['def']; //output- thisisdef[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/31384-solved-get-vars-from-url/#findComment-145301 Share on other sites More sharing options...
kenrbnsn Posted December 20, 2006 Share Posted December 20, 2006 You should look at the functions [url=http://www.php.net/parse_url]parse_url()[/url] and [url=http://www.php.net/parse_str]parse_str()[/url].Ken Link to comment https://forums.phpfreaks.com/topic/31384-solved-get-vars-from-url/#findComment-145306 Share on other sites More sharing options...
Shu Posted December 20, 2006 Author Share Posted December 20, 2006 [quote author=Orio link=topic=119407.msg489040#msg489040 date=1166636075][code]echo $_GET['abc']; //output- thisisabcecho $_GET['def']; //output- thisisdef[/code]Orio.[/quote]this will only work if thats the current url the user is requesting. but in my case not.the url is generated on the script itself.[quote author=kenrbnsn link=topic=119407.msg489045#msg489045 date=1166636131]You should look at the functions [url=http://www.php.net/parse_url]parse_url()[/url] and [url=http://www.php.net/parse_str]parse_str()[/url].Ken[/quote]thanks the parse_str function is what i needed Link to comment https://forums.phpfreaks.com/topic/31384-solved-get-vars-from-url/#findComment-145325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.