Skip to content

Instantly share code, notes, and snippets.

@flukeout
Created November 24, 2009 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flukeout/242284 to your computer and use it in GitHub Desktop.
Save flukeout/242284 to your computer and use it in GitHub Desktop.
Zeep Mobile - Sending a message
<?php
// Created by Chris Teft Hughes
// Copyright (c) 2009. All rights reserved.
// Released under MIT License
// ADD TO YOUR CONFIG FILE
define('ZEEPSECRECTKEY', 'yoursecret');
define('ZEEPAPIKEY', 'yourapikey');
define('ZEEP_ENDPOINT', 'https://api.zeepmobile.com/messaging/2008-07-14/send_message');
// SEND MESSAGE ZEEP API CODE
// LETS SAY YOU GET THE MSG FROM A POST FIELD
$messageText = strip_tags(trim($_POST['messageText']));
$httpDate = gmdate('D, d M Y H:i:s \G\M\T');
$postData = 'user_id=' . $yourUsersUniqueID . '&body=' . urlencode($messageTextEncoded);
$canonicalString = ZEEPAPIKEY . $httpDate . $postData;
$hashSig = base64_encode(hash_hmac('sha1', $canonicalString, ZEEPSECRECTKEY, TRUE));
$headers = array();
$headers[] = "Authorization: Zeep " . ZEEPAPIKEY . ":" . $hashSig;
$headers[] = "Date: $httpDate";
$c = curl_init(ZEEP_ENDPOINT);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
curl_setopt($c, CURLOPT_POSTFIELDS, $postData);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($c);
curl_close($c);
if($result == 'OK') {
// SUCCESS!
} else {
// FAILED - ECHO TO SEE ERROR
}
?>
@MakeApps
Copy link

Hello Friend,

Can you please tell where I should add the mobile number in this sample.
On the following link

$postData = 'user_id=' . $yourUsersUniqueID . '&body=' . urlencode($messageTextEncoded);

$yourUsersUniqueID = Is this a mobile number?????

If I want to send sms to 1253658662 number where I should add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment