1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.
Ads by Lake Quincy Media

Wednesday, March 3, 2010

Way2Sms php

$post_data = "username=username&password=pwd";
//$header_array[]="User-Agent:
$url = "http://wwwa.way2sms.com/auth.cl";
$cookie = tempnam ("/tmp", "CURLCOOKIE");
$ch = curl_init();
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
curl_setopt($ch,CURLOPT_REFERER,"http://wwwg.way2sms.com//entry.jsp");
$content = curl_exec( $ch );
$response = curl_getinfo( $ch );


$url = "http://wwwa.way2sms.com//jsp/InstantSMS.jsp?val=0";
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 0 );
$content = curl_exec( $ch );
$response = curl_getinfo( $ch );
//site content in the instant sms
$tmp = substr ($content,strrpos($content,"Action",0)+15,15);
//value of Action=custfromnnnn which will be different for each customer
$id = substr($tmp,0,strrpos($tmp,"\"",0));


$post_data = "custid=undefined&HiddenAction=instantsms&Action=$id&login=&pass=&MobNo=9986966496&textArea=test sms";
$url = "http://wwwa.way2sms.com/FirstServletsms?custid=";
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 0 );
$content = curl_exec( $ch );
$url = "http://wwwa.way2sms.com/jsp/logout.jsp";
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 0 );
$content = curl_exec( $ch );
//echo $content;
?>

14 comments:

  1. Hi, it would be great if you could highlight which all things need customization here. Password and ID are evident but what about other things such as custID and custfrom?

    Where can I get to know those. Please mail me at sheoran1 (AT) yahoo.com if you can. Thanks.

    ReplyDelete
  2. The values other than the userid and password you will get from the source of the way2sms send mail page.You can see lot of hidden fields in this page.custid have some constant value custfrom value will vary for each customer. So you have to first logged into the site and check the value of the hidden input field and replace that into your code.

    ReplyDelete
  3. can u please elaborate the procedure for using this code on to our website and sending sms?

    ReplyDelete
  4. Thanks, It works great.

    ReplyDelete
  5. there's some error in curl_init() .. please let me know the correct one

    ReplyDelete
  6. I am not able to find hidden fields for the custid and custfrom in the send sms and send email page. FYI I am a free user. Can you plz tell me that this api works for the free user alos OR should I have to buy their service.

    ReplyDelete
  7. Can you explain why have you logged out in the code, would not logging out make a difference?

    ReplyDelete
  8. The code works!! its gr8!! But how to send sms to multiple numbers at once??? using semicolon to separate no.s is not working... plz help!!

    ReplyDelete
  9. The Code works..

    ReplyDelete
  10. Works Great Man Thanks............

    ReplyDelete
  11. Hurry!! It worked.......Thanks!!

    ReplyDelete
  12. Thanks it works well. But i could not find any solution with this code to send group messages. Can you tell me how to send a group message.

    ReplyDelete
  13. how to delete sent sms ?

    ReplyDelete
  14. Hi friend, this is vishal here..
    I have used this script and it really worked...
    This script is really too great...

    but i have some question about that..when u feel free please help me..please chat me on vruvishal@gmail.com

    Thanks,
    Vishal Uamraneeya
    vruvishal@gmail.com

    ReplyDelete

Related Posts with Thumbnails