Demande d'aide pour une traduction de scipt perl | Titre du sujet : Demande d'aide pour une traduction de scipt perl par ufolep16 sur 19/01/2007 21:18:31
Bonjour
pour adapter un script perl sur le serveur free.fr j'aurais besoin de le traduire en php, mais je ne m'y connais pas assez. Je m'en remet donc a une bonne ame.
voici ce script :
#!/usr/bin/perl -w
use strict;
use LWP::Simple qw(!head); #so we don't get errors, CGI has a 'head' as well... use CGI qw(:standard); # then only CGI.pm defines a head()
#resp #<?xml version="1.0" encoding="utf-8"?> #<string xmlns="http://gisdata.usgs.gov/XMLWebService ... >string</string> my $ws_url = 'http://gisdata.usgs.gov/XmlWebService ... tion_Service.asmx/'; my $inv = -1000001; #invalid elevation #http://gisdata.usgs.net/XMLWebService ... tion_service.asmx/';
my $latLng = param('latLong'); my $content = "0.0\n"; my $wsCall; my $regex = '-*\d*\.\d+'; #validation of lat/long my $needToCache = 0;
if($latLng) { my($e) = $inv;
#getElevation via web service call my @latLong = split(',', $latLng); my $lat = $latLong[0]; my $lng = $latLong[1]; if(($lat =~ /$regex/) and ($lng =~ /$regex/)) { $wsCall = $ws_url. "getElevation?X_Value=$lng&Y_Value=$lat&Elevation_Units=FEET&Source_Layer=&Elevation_Only=0"; #call the USGS webservices $content = get $wsCall; } else { die "invalid coords: $lat, $lng\n"; } } print "Content-type: text/xml\n\n"; print "";
if($content) { print $content; } else { (print STDOUT "USGS web-service returned empty page."); }
|
|