GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
General use of GTOPO30  XML
Forum Index -> General
Author Message
Anonymous



Hello, and firstly, thanks for the amazingly great web services.

Sorry if this is a stupid question but I'm trying to use the data returned from your elevation finder.

The problem I have is that I'm using PHP which for some reason isn't getting just a number but some kind of resource id.

I've got something like this:

$val = fopen("http://ws.geonames.org/gtopo30?lat=47.01&lng=10.2", "r");

If anyone knows what I'm doing wrong. Please tell me. I'm going a bit mad not being able to work it out.

Thanks!
Anonymous



you must fread() what you fopen()
Anonymous



Or: Code:
$data =  file_get_contents($url, false);
And if you have to deal with Timeouts, Curl is an option:
Code:
$handle = curl_init();
 curl_setopt ($handle, CURLOPT_URL, $url);
 curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 5);
 curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1);
 $data= curl_exec($handle);
 curl_close($handle);
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team