Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. // function that gathers vars for the curl req
  2. echo json_encode($login);
  3. $ch = curl_init($Mid_url); //Init curl
  4. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  5. curl_setopt($ch, CURLOPT_POST, true);
  6. // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirect to new housing page
  7. curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($login)); // concat ucid/pass
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return results to stdout instead of echo
  9. $result = curl_exec($ch); // send the curl, return result (actually html page after redir)
  10. curl_close($ch);
  11. return $result;
  12. }
  13.  
  14. /* get data from index.thml */
  15. // $data = json_decode($HTTP_RAW_POST_DATA);
  16. $ucid_POST = 'myusername';//$data->ucid;
  17. $pass_POST = 'mypassword';//$data->pass;
  18.  
  19. /* get response from mid */
  20. $result = toMid($ucid_POST, $pass_POST);
  21. echo json_decode($result);
  22.  
  23. // raw data I get in the terminal when I execute this php
  24.  
  25. {"response":{"njitucid":"mysusername","njitsuccess":1,"dbucid":"myusername","dbsuccess":"0","debug":""}SUCCESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement