[ create a new paste ] login | about

Link: http://codepad.org/xRZ3zEcU    [ raw code | output | fork ]

PHP, pasted on Sep 9:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

$data = "cursor:pointer; background:url(http://maps.google.com/staticmap?center=38.7376583333,-9.1658583333&maptype=satellite&zoom=14&size=300x300&key=ABQIAAAAvQ9c8pqKsi8K2dzb7UM9MhS13VDmd70a9rmDETSCgg2iXt3XnhQSnX4vFKfWO-3vdWNV5HHBnSLWLQ&sensor=true&hl=pt) no-repeat";

$url = substr($data, strpos($data, 'url(') + 4);
$url = parse_url(substr($url, 0, strpos($url, ') ')));

print_r($url);

$query = explode('&', $url['query']);
$querypairs = array();

for ($i = 0, $l = count($query); $i < $l; $i++) {
    $pair = explode('=', $query[$i]);
    $querypairs[$pair[0]] = $pair[1];
}

print_r($querypairs);

?>


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Array
(
    [scheme] => http
    [host] => maps.google.com
    [path] => /staticmap
    [query] => center=38.7376583333,-9.1658583333&maptype=satellite&zoom=14&size=300x300&key=ABQIAAAAvQ9c8pqKsi8K2dzb7UM9MhS13VDmd70a9rmDETSCgg2iXt3XnhQSnX4vFKfWO-3vdWNV5HHBnSLWLQ&sensor=true&hl=pt
)
Array
(
    [center] => 38.7376583333,-9.1658583333
    [maptype] => satellite
    [zoom] => 14
    [size] => 300x300
    [key] => ABQIAAAAvQ9c8pqKsi8K2dzb7UM9MhS13VDmd70a9rmDETSCgg2iXt3XnhQSnX4vFKfWO-3vdWNV5HHBnSLWLQ
    [sensor] => true
    [hl] => pt
)


Create a new paste based on this one


Comments: