Advertisement
Guest User

Untitled

a guest
Aug 16th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. $url = 'https://www.newsletter2go.de/de/api/get/status';
  2. $data = [
  3. 'key' => 'UNSER-API-KEY'
  4. ];
  5.  
  6. //url-ify the data for the POST
  7. foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
  8. $data_string = rtrim($data_string,'&');
  9.  
  10. //debug
  11. echo($data_string);
  12.  
  13. //open connection
  14. $ch = curl_init();
  15.  
  16. //set the url, number of POST vars, POST data
  17. curl_setopt($ch,CURLOPT_URL,$url);
  18. curl_setopt($ch,CURLOPT_POST,count($data));
  19. curl_setopt($ch,CURLOPT_POSTFIELDS,$data_string);
  20.  
  21. //execute post
  22. $result = curl_exec($ch);
  23.  
  24. //debug
  25. print $result;
  26.  
  27. //close curl
  28. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement