Advertisement
joris

Sample POST Curl

Sep 11th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. // Get cURL resource
  3. $curl = curl_init();
  4. // Set some options - we are passing in a useragent too here
  5. curl_setopt_array($curl, array(
  6.     CURLOPT_RETURNTRANSFER => 1,
  7.     CURLOPT_URL => 'http://www.batavia-air.com/public/etiket/includes/class/booking/template/cariBookAjaxPros2.php',
  8.     CURLOPT_USERAGENT => 'Sample CURL Request',
  9.     CURLOPT_POST => 1,
  10.     CURLOPT_POSTFIELDS => array(
  11.             page => 'booking',
  12.         ajax_type => 'non_ajax',
  13.         radio => 'flight',
  14.         ruteBerangkat => 'CGK',
  15.         ruteTujuan => 'AMQ',
  16.         ruteKembali => 'kembali',
  17.         tglBerangkatPergi => '23',
  18.         blnthnBerangkatPergi => '12/12',
  19.         kalenderPergi => '',
  20.         jmlPenumpang => '1',
  21.         jmlInfant => '0',
  22.                 page => 'booking'
  23.     )
  24. ));
  25. // Send the request & save response to $resp
  26. $resp = curl_exec($curl);
  27.  
  28. if(!curl_exec($curl)){
  29.     die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
  30. }
  31.  
  32. // Close request to clear up some resources
  33. curl_close($curl);
  34.  
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement