It seems there i a package for PHP
Aug 17, 2020
4
Level 2
needing help for using curl lib !
hello, guys, I need help here :(. I have searched a lot on how to convert the code below into a code that can be used in PHP using the Curl library.
curl -v -u '<YOUR_ACCOUNT_ID>:<YOUR_ACCOUNT_TOKEN>' https://api.karix.io/message/ \
-H 'content-type: application/json' \
-d '{
"channel": "sms",
"source": "+13253077759",
"destination": ["+1XXX8323XXX"],
"content": {
"text": "Sent from cURL"
}
}'
but there are some points that I could not understand! I understood some of the options used, for example:
$ch = curl_init(); // for initialize the request
curl_setopt($ch, CURLOPT_URL, $url); // setup the url
curl_setopt($ch, CURLOPT_POST, true); // make it post request
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // adding the headers
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); casting the data to json format and send it with the request .
$result = curl_exec($ch); // execut the request and store the response into $result variable.
But what I don't understand is this line:
curl -v -u '<YOUR_ACCOUNT_ID>:<YOUR_ACCOUNT_TOKEN>' https://api.karix.io/message/ \
I have that account_id and the token but I don't know where to put them exactly! and what is the meaning of these options :
-v -u
thanks in advance for your help.
Please or to participate in this conversation.