Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-mb committed Feb 11, 2015
1 parent 0addea2 commit 676558e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
52 changes: 28 additions & 24 deletions README.md
Expand Up @@ -7,30 +7,34 @@ Use the script below to send an SMS in php.
2. In your develeoper dashboard, click Apps in the left menu
3. Click create new app
4. Name your app, and click create
5. Plug your app key and secret into the script below

<?php
$key = "your_app_key";
$secret = "your_app_secret";

$user = "application\\" . $key . ":" . $secret;
$message = array("message"=>"Test");
$data = json_encode($message);
$ch = curl_init('https://messagingapi.sinch.com/v1/sms/+16507141052');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD,$user);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
if(curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
} else {
echo $result;
}
curl_close($ch);
?>
5. Plug your app key and secret into the script below

<?php
$key = "your_app_key";
$secret = "your_app_secret";
$user = "application\\" . $key . ":" . $secret;
$message = array("message"=>"Test");
$data = json_encode($message);
$ch = curl_init('https://messagingapi.sinch.com/v1/sms/+16507141052');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD,$user);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

$result = curl_exec($ch);

if(curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
} else {
echo $result;
}

curl_close($ch);

?>

##Run It
Once you've put your app key and secret into the above script, run it from the command line using:
Expand Down
8 changes: 6 additions & 2 deletions sms.php
Expand Up @@ -12,11 +12,15 @@
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

$result = curl_exec($ch);

if(curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
echo 'Curl error: ' . curl_error($ch);
} else {
echo $result;
echo $result;
}

curl_close($ch);

?>

0 comments on commit 676558e

Please sign in to comment.