Advertisement
M-KIOSPAYID

MONETES

Sep 29th, 2021
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. //url 1 yg mau diambil datanya
  3. $BASE_URL = "http://172.16.0.188:1688/sim_status?username=CAN3269095&to=082169000123";
  4.  
  5. ///url yg mau dikirim datanya isi dari url1 ke url2
  6. $url = 'http://172.16.0.4:81818/reportku/gaspol/data';
  7.  
  8. $data = array("first_name" => "First name","last_name" => "last name","email"=>"email@gmail.com","addresses" => array ("address1" => "some address" ,"city" => "city","country" => "CA", "first_name" => "Mother","last_name" => "Lastnameson","phone" => "555-1212", "province" => "ON", "zip" => "123 ABC" ) );
  9. header("Refresh: 5");
  10. $postdata = json_encode($data);
  11. $ch = curl_init($url);
  12. curl_setopt($ch, CURLOPT_POST, 5);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
  16. $result = curl_exec($ch);
  17. $output = curl_exec($ch);
  18. curl_close($ch);
  19. print_r ($result);
  20.  
  21. echo json_encode($ch);
  22. echo json_encode($data);
  23. echo $output;
  24.  
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement