Advertisement
gujingc

TNP API code

Sep 16th, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | Fixit | 0 0
  1. β€œswitch_to_blog(65);
  2. $curl = curl_init();
  3.  
  4. curl_setopt_array($curl, array(
  5. CURLOPT_URL => "https://care.sasnetghana.org//wp-json/newsletter/v2/subscriptions",
  6. CURLOPT_RETURNTRANSFER => true,
  7. CURLOPT_ENCODING => "",
  8. CURLOPT_MAXREDIRS => 10,
  9. CURLOPT_TIMEOUT => 30,
  10. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  11. CURLOPT_CUSTOMREQUEST => "POST",
  12. CURLOPT_POSTFIELDS => "email=sehjad123%40gmail.com&lists=%5B1%5D%5B3%5D",
  13. CURLOPT_HTTPHEADER => array(
  14. "cache-control: no-cache",
  15. "content-type: application/x-www-form-urlencoded",
  16. "postman-token: 635aa2be-3a76-f6ef-7bf7-32deac23318b"
  17. ),
  18. ));
  19.  
  20. $response = curl_exec($curl);
  21. $err = curl_error($curl);
  22.  
  23. curl_close($curl);
  24.  
  25. if ($err) {
  26. echo "cURL Error #:" . $err;
  27. } else {
  28. echo $response;
  29. }
  30. ”
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement