Official Site

click here to view our new site launched

Pages

Friday, April 27, 2012

WAYSMS API PHP


  function sendSMS($url) {
    $userAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FAILONERROR, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
    $html = curl_exec($ch);
    if (!$html) {
        echo "
CURL Page: " . $url;

        echo "
CURL Error Number: " . curl_errno($ch);

        echo "
CURL Error Desc: " . curl_error($ch);

        return FALSE;
    } else {
        return trim($html);
    }
    }
   
// Note: provider can be changed by setting $provider  to any of the provider say 'fullonsms'
    $toMobile ='Recipient number';
    $message=urlencode("hello world");
    $uid='Your mobile no';
    $password='Password';
    $provider='way2sms';


$url="http://ubaid.tk/sms/sms.aspx?uid=$uid&pwd=$password&msg=$message&phone=$toMobile&provider=$provider";
  
 if(sendSMS($url)=='1')
echo'\n Message sent...!';


/* Note:
List of Providers: way2sms, fullonsms, smsindia, whozzat, smsinside, site2sms
*/

2 comments:

  1. i got this type of error
    CURL Page: http://ubaid.tk/sms/sms.aspx?uid=8870883448&pwd=1984&msg=hello+world&phone=7200476744&provider=way2sms CURL Error Number: 22 CURL Error Desc: The requested URL returned error: 503

    ReplyDelete
    Replies
    1. The service is under maintenance right now...

      Delete

$2.49 .COM at GoDaddy.com! Expires 5/14/13