viernes, 27 de enero de 2023

curl flowroute API

 <?php

$username="ambiorixg12";

$password="d9914a2s1111refadfe43";

$url = "https://api.flowroute.com/v2.1/messages";

$data = array(

    "to" => "12057143489",

    "from" => "18452375521",

    "body" => "jane_mc@gmail.com",

);

$encodedData = json_encode($data);

$curl = curl_init($url);

$data_string = urlencode(json_encode($data));

curl_setopt($curl, CURLOPT_USERPWD, $username . ":".$password);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

curl_setopt($curl, CURLOPT_POST, true);

curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedData);

$result = curl_exec($curl);

curl_close($curl);

print $result;


?>

https://developer.flowroute.com/api/messages/v2.1/send-an-sms/


https://phppot.com/php/php-curl-post/
curl version


curl https://api.flowroute.com/v2.1/messages \
-H "Content-Type: application/vnd.api+json" -X POST -d \
'{"to": "18412345676", "from": "18452375521", "body": "Hello World !"}' \
-u ambiorixg12:d99a3deadfe43

No hay comentarios:

Publicar un comentario