Guest User

Untitled

a guest
Oct 4th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. // jSON URL which should be requested
  2. $json_url = 'https://secure.cashflows.com/gateway/remote';
  3.  
  4. $username = '5949138'; // authentication
  5. $password = 'Ad368w9XYw'; // authentication
  6.  
  7. // jSON String for request
  8. $json_string = [
  9. 'amount' => 'amount',
  10. 'currency' => 'currency',
  11. ];
  12.  
  13. // Initializing curl
  14. $ch = curl_init( $json_url );
  15.  
  16. // Configuring curl options
  17. $options = array(
  18. CURLOPT_RETURNTRANSFER => true,
  19. CURLOPT_USERPWD => $username . ':' . $password, // authentication
  20. CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
  21. CURLOPT_POSTFIELDS => $json_string,
  22. );
  23.  
  24. // Setting curl options
  25. curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
  26. curl_setopt_array( $ch, $options );
  27.  
  28. // Getting results
  29. $result = curl_exec($ch); // Getting jSON result string
  30.  
  31. return $result;
Add Comment
Please, Sign In to add comment