Advertisement
Guest User

Untitled

a guest
Feb 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. $url = 'http://52.233.158.172/change/api/hr/account/register';
  3.  
  4. $ch = curl_init($url);
  5.  
  6. $teamname = secure_data($_POST['teamname']);
  7. $password = secure_data($_POST['password']);
  8. $username = secure_data($_POST['username']);
  9. $surname = secure_data($_POST['surname']);
  10. $email = secure_data($_POST['email']);
  11.  
  12. $data = array(
  13. 'Teamname' => $teamname,
  14. 'Password' => $password,
  15. 'name' => $username,
  16. 'surname' => $surname,
  17. 'mail' => $email
  18.  
  19.  
  20. );
  21. $payload = json_encode(array("user" => $data));
  22.  
  23. curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
  24.  
  25. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
  26.  
  27. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  28.  
  29. $result = curl_exec($ch);
  30.  
  31. curl_close($ch);
  32.  
  33.  
  34. echo "<pre>$result</pre>";
  35.  
  36.  
  37. $data = json_decode(file_get_contents('php://input'), true);
  38.  
  39. echo '<pre>'.$data.'</pre>';
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement