Guest User

Untitled

a guest
Dec 13th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. {"message":"invalid json"}
  2.  
  3. $json = '{
  4. "sex": "'.$gender.'",
  5. "age": '.$age.',
  6. "evidence": [
  7. {"id": "'.$symptom_id1.'", "choice_id": "present", "initial": true},
  8. {"id": "'.$symptom_id2.'", "choice_id": "present", "initial": true},
  9. {"id": "p_7", "choice_id": "'.$test1.'"},
  10. {"id": "p_8", "choice_id": "'.$test2.'"},
  11. {"id": "p_9", "choice_id": "'.$test3.'"},
  12. {"id": "p_10", "choice_id": "'.$test4.'"},
  13. {"id": "p_28", "choice_id": "'.$test5.'"},
  14. {"id": "'.$location.'", "choice_id": "present"}
  15. ],
  16. "extras": {
  17. "disable_groups": true
  18. }
  19. }';
  20. $ch = curl_init('https://api.infermedica.com/v2/diagnosis');
  21. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
  23. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  24. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  25. 'Content-Type: application/json',
  26. 'Content-Length: ' . strlen($json),
  27. 'app_id: '. APP_ID,
  28. 'app_key: '. APP_KEY,
  29. 'Interview-Id: '.$interview_id,
  30. 'User-Id: '. $hasheduser_id
  31. ]);
  32. $result = curl_exec($ch);
  33.  
  34. echo '<pre>';
  35. print_r( $result );
  36. echo '</pre>';
Add Comment
Please, Sign In to add comment