Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $url = 'http://www.webservicex.net/airport.asmx/GetAirportInformationByCountry';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'country=paramAero');
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- $result = curl_exec($ch);
- $err = curl_error($ch);
- curl_close($ch);
- $result = substr($result, 114);
- $result = substr($result,0,- 30);
- $result = chop($result);
- $borra = array("Table","CityOrAirportName","<",">","/");
- $output = str_replace($borra, '',$result);
- $output = explode(PHP_EOL, $output);
- $xml = simplexml_load_string($xml);
- $i=0;
- $aero = array();
- foreach ($output as $value) {
- if(strlen($value)>3){
- $aero[++$i] = $value;
- }
- }
- echo '<select id="campoAeropuerto" name="campoAeropuerto">';
- foreach($aero as $key => $value){
- echo '<option value="'.$key.'">'.$value.'</option>';
- }
- echo '</select>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement