Created
October 17, 2014 12:40
-
-
Save Irfan-Ansari/5fbb14c138b090a72dc8 to your computer and use it in GitHub Desktop.
Grab URL Parameters - PHP code snippt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://www.IrfanAnsari.com/embedviz?q=select+col9+from+1c16ZytvOGsazT5r4borWzDSKmRy1dyeCqzOHdnWb&viz=MAP&h=false&lat=28.098107336734692&lng=68.93999515039059&t=1&z=6&l=col9&y=2&tmplt=2&hml=GEOCODABLE'; | |
function grab_url($url) { | |
if(!empty($url)) { | |
$urllist=parse_url($url); | |
if(is_array($urllist) && isset($urllist["query"])) { | |
$keyvalue_list=explode("&",($urllist["query"])); | |
$keyvalue_result=array(); | |
foreach($keyvalue_list as $key=>$value) { | |
$keyvalue=explode("=",$value); | |
if(count($keyvalue)==2) | |
$keyvalue_result[$keyvalue[0]]=$keyvalue[1]; | |
} | |
} | |
} | |
return $keyvalue_result; | |
} | |
var_dump( grab_url($url) ); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment