treehouse : what would you like to learn today?
Web Design Web Development iOS Development

sms api problem

  • Hi Folks i am trying to use the sms api services of 160by2.com i already downloaded lot of codes from internet but nothing is working can anybody from you know how to implement it.

  • Link us to the api documentation and tell us what you are trying to do, then we might be able to help you.

  • here i am pasteing this api code i found on internet its working properly, but sms is not being deliverd by is <?php /**************************** HaariSoft SMS API 160by2 sms api CURL script ___________ HARISH JOSE The ultimate programmer *******************************/ $username="9xxxxxxxxx"; //replace the username with your 160by2 username $password="password"; //replace the password with your 160by2 password $tomob="9xxxxxxxxx"; $message = rawurlencode("haii..."); $post_data = "username=".$username."&password=".$password."&button=Login"; $url = "<a href="http://www.160by2.com/re-login" target="_blank" rel="nofollow">http://www.160by2.com/re-login"; $cookie = tempnam ("/tmp", "CURLCOOKIE"); $ch = curl_init(); curl_setopt( $ch, CURLOPT_USERAGENT,"User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0" ); 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 ); curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 ); curl_setopt($ch,CURLOPT_REFERER,"http://www.160by2.com/index.html"); $content = curl_exec( $ch ); $u= curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); $u=substr($u, 86); if(strstr($content,"Unauthorized Login")) { $cont="Invalid Username or Password"; } else { //sending sms by HaariSoft $post_data1 = "bogoros=$u&hid_exists=&bogorosaction=sa65sdf656fdfd&mobile1=$tomob&msg1=$message&btnsendsms=Send Now"; $url = "http://www.160by2.com/jan22sendsms"; 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_data1); 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_MAXREDIRS, 10 ); curl_setopt($ch,CURLOPT_REFERER,"http://www.160by2.com/SendSMS.action"); $content = curl_exec( $ch ); if(strstr($content,"Invalid Mobile number")) { $cont="Invalid Mobile Number or Message. Check the recepient mobile no."; } else { $cont="Your message has been successfully Sent to ".$tomob; } } echo $cont; ?>