Created
October 14, 2013 12:46
-
-
Save urre/6975034 to your computer and use it in GitHub Desktop.
curl gmaps
This file contains hidden or 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 | |
| /* gets the data from a URL */ | |
| function get_data($url) { | |
| $ch = curl_init(); | |
| $timeout = 5; | |
| $options = array( | |
| CURLOPT_URL => $url, | |
| CURLOPT_RETURNTRANSFER => 1, | |
| CURLOPT_RETURNTRANSFER => true, | |
| CURLOPT_CONNECTTIMEOUT => $timeout, | |
| CURLOPT_HTTPHEADER => array('Content-type: application/json') | |
| ); | |
| curl_setopt_array( $ch, $options ); | |
| $data = curl_exec($ch); | |
| curl_close($ch); | |
| return $data; | |
| } | |
| $url = 'https://maps.google.com/maps/ms?authuser=0&vps=2&ie=UTF8&msa=0&output=kml&msid=215263217674177766593.0004e648f96b2f01e9bbb'; | |
| $returned_content = get_data($url); | |
| $test = $returned_content; | |
| $test2 = explode(',', $test); | |
| echo '<pre>'; | |
| print_r($test2); | |
| echo '</pre>'; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment