SMS button |
2/23/2014 2:01:43 PM |
PHPRunner General questions | |
S
smith author
Hi |
|
![]() |
Sergey Kornilov admin 2/24/2014 |
Most likely some error happens in your PHP code. See this article that explains how you can troubleshoot your button's code: |
S
|
smith author 2/24/2014 |
Hi Admin Thank you for the point Most likely some error happens in your PHP code. See this article that explains how you can troubleshoot your button's code: http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/ |
S
|
smith author 2/26/2014 |
anyone? |
S
|
smith author 3/13/2014 |
Any suggestions? Hi I have made an SMS handle button Below is the code, but the button stucks on the "Please wait message", no error, no result Client after params["txt"] = document.getElementById('sms_form').value; ctrl.setMessage("Please wait..."); SERVER global $dal; $dal_TableName = $dal->Table("tal_school_job"); $sms_list = ""; foreach(@$keys as $keyblock) { $arr=explode("&",refine($keyblock["ID"])); if(count($arr)<1) continue; $arr2=array(); $arr2["ID"]=urldecode(@$arr[0]); $where = KeyWhere($arr2); $rstmp = $dal_TableName->Query($where,""); $datatmp=db_fetch_array($rstmp ); if ($datatmp["Parent_Contact"]) $sms_list.=$datatmp["Parent_Contact"].","; } if ($sms_list) $sms_list=substr($sms_list,0,-1); echo $sms_list; if ($text) $text.=", "; $text.=$params["txt"]; $mobile=$sms_list; ////////// $username = "xxxxxxxxxxx"; $password = "xxxxx"; $sendername = "XXXX"; $message= urlencode($text); if ($username && $password && $to && $message) { $data = "?username=$username&password=$password&sendername=$sendername&mobile=$mobile&message=$message&routetype=0"; $data = urlencode($data); $file = fopen('clients.xxxxxxx.com/sms_api/sendsms.php'.$data,'r';); $output = fread($file,1024); fclose($file); echo $output; } /////////// CLIENT AFTER // Put your code here. var message = result["txt"] + " !!!"; ctrl.setMessage(message); Below is the http API of the sms service. <?php $request = ""; $param["username"] = "xxxx"; // YOUR LOGIN USERNAME $param["password"] = "yyyy"; // YOUR LOGIN PASSWORD $param["sendername"] = "WEBSMS"; // YOUR SENDERID $param["mobile"] = "$mobile"; // Receiver Mobile NO $param["routetype"] = "1"; $param["message"] = "Hi Customer, Thanks for using our service. -- www.xxxxxxxx.com"; // Receiver MSG foreach($param as $key=>$val){$request.= $key."=".urlencode($val); $request.= "&";} $request = substr($request, 0, strlen($request)-1); $host = "clients.xxxxx.com"; $script = "/sms_api/sendsms.php"; $request_length = strlen($request); $method = "POST"; if ($method == "GET"){$script .= "?$request";} $header = "$method $script HTTP/1.1\r\n"; $header .= "Host: $host\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: $request_length\r\n"; $header .= "Connection: close\r\n\r\n"; $header .= "$request\r\n"; $socket = @fsockopen($host, 80, $errno, $errstr); if ($socket) { fputs($socket, $header); while(!feof($socket)){$output[] = fgets($socket);} fclose($socket); } ?> Smith |