Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //url 1 yg mau diambil datanya
- $BASE_URL = "http://172.16.0.188:1688/sim_status?username=CAN3269095&to=082169000123";
- ///url yg mau dikirim datanya isi dari url1 ke url2
- $url = 'http://172.16.0.4:81818/reportku/gaspol/data';
- $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" ) );
- header("Refresh: 5");
- $postdata = json_encode($data);
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_POST, 5);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
- $result = curl_exec($ch);
- $output = curl_exec($ch);
- curl_close($ch);
- print_r ($result);
- echo json_encode($ch);
- echo json_encode($data);
- echo $output;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement