Virajsinh

TextLocal PHP POST API

Dec 16th, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. //TextLocal SignUp With 1000 SMS Free Credits
  2. //https://www.textlocal.in/refer-a-friend?mgm=643905
  3.  
  4. <?php
  5. // Account details
  6. $apiKey = urlencode(‘Your apiKey’);
  7. // Message details
  8. $numbers = array(918123456789, 918987654321);
  9. $sender = urlencode(‘TXTLCL’);
  10. $message = rawurlencode(‘This is your message’);
  11.  
  12. $numbers = implode(,, $numbers);
  13.  
  14. // Prepare data for POST request
  15. $data = array(‘apikey’ => $apiKey, ‘numbers’ => $numbers, “sender” => $sender, “message” => $message);
  16. // Send the POST request with cURL
  17. $ch = curl_init(‘https://api.textlocal.in/send/’);
  18. curl_setopt($ch, CURLOPT_POST, true);
  19. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  20. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  21. $response = curl_exec($ch);
  22. curl_close($ch);
  23. // Process your response here
  24. echo $response;
  25. ?>
Add Comment
Please, Sign In to add comment