Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // JSON stuff
  2.  
  3. $data = " Credentials: {
  4. Username: \"EmotiveTest\",
  5. Password: \"hfh0293h20hHHHFh409\",
  6. },
  7. Customer: {
  8. Reference: \"SESSIONID\"
  9. },
  10. Parameters: {
  11. Term: \"60\",
  12. Deposit: \"10\",
  13. DepositType: \"Percentage\",
  14. AnnualMileage: \"10000\"
  15. },
  16. VehicleRequests: [
  17. {
  18. Id: \"1234\",
  19. Dealer: \"Associated Dealer Key\",
  20. Vehicle: {
  21. CashPrice: \"10000\",
  22. CurrentMileage: \"100\",
  23. RegistrationDate: \"2013-09-01\",
  24. IsNew: \"false\",
  25. Identifier: \"54321\",
  26. IdentifierType: \"CapShortCode\",
  27. Type: \"Car\",
  28. StockId: \"12345\",
  29. ImageUrl: \"http://notworking.com/1234.jpg\",
  30. DealerVehicleUrl: \"http://notworking.com/1234/\",
  31. }
  32. }
  33. ]";
  34.  
  35. $data_string = json_encode($data);
  36.  
  37. $ch = curl_init('https://services.codeweavers.net/public/v2/JsonFinance/Calculate');
  38. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  39. curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
  40. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  41. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  42. 'Content-Type: application/json',
  43. 'Content-Length: ' . strlen($data_string))
  44. );
  45.  
  46. $result = curl_exec($ch);
  47.  
  48. echo display_array($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement