Advertisement
aryraditya

Untitled

Nov 19th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1.     $url = 'http://dev.api.ean.com/ean-services/rs/hotel/v3/info?cid=55505
  2.                &minorRev=28
  3.                &apiKey=bhn947567fcqxznw5vxhu25p
  4.                &locale=id_ID
  5.                &currencyCode=IDR
  6.                &xml=
  7.                <HotelInformationRequest>
  8.                  <hotelId>'.$id.'</hotelId>
  9.                  <options>0</options>
  10.                </HotelInformationRequest>';
  11.        
  12.         $url = preg_replace('/\s+/', '', $url);
  13.  
  14.         $ch = curl_init();
  15.         curl_setopt($ch, CURLOPT_URL, $url);
  16.         curl_setopt($ch, CURLOPT_HTTPHEADER,array('Accept: text/xml,application/xml'));
  17.         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  18.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  19.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  20.         curl_setopt($ch, CURLOPT_TIMEOUT, 15);
  21.         $retValue = curl_exec($ch);
  22.         curl_close($ch);
  23.        
  24.        
  25.     //parse xml to object
  26.         $model = new SimpleXMLElement($retValue);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement