Hi, I have some following urls: So, how to get the red text (value of MERCHANTID) in those urls? Thanks in advance.
Assuming $url is the URL, $vars['MERCHANTID'] will be what you want... parse_str(parse_url($url, PHP_URL_QUERY), $vars); echo $vars['MERCHANTID']; PHP:
Actually the code he wrote is a way but i think not the best. Notice the URL contains a GET element wich u can retrieve using the $_GET['']; Code (markup): variable. I think i'd rather go for this: if(isset($_GET['MERCHANTID'])){ $merchid = $_GET['MERCHANTID']; } Code (markup): Or you could create a for each loop on the GET array and place it in a new one check if the merchantid value exists. -Wickedd
He never said if the URL was a URL the script was running in though... $_GET might not have the info.