android connection to php for sending login verification code to mobile -


i developing android app website.in website login, every time after checking username , password verification code send user filling next part of login page.in android app same functionalities able check username , password.but not sure if possible trigger php code sending verification code mobile.please tell me possible or not.i using httppost in android json parsing.

sndactivation_code.php

<?php set_include_path("/home2/tradeni1/php"); require_once("http/request2.php"); if(!isset($_session)) { session_start(); } if(isset($_request['user_id'])) { $id=$_session['uid']; $sql=mysql_query("insert code (`id` ,`code` ,`user_id` ,`status`) values ('' , '', '$id','0')"); $lastid=mysql_insert_id(); $code=rand(100000,999999);//"stock_".$lastid; $_session['code']=$code; $sql1=mysql_query("update code set code = '$code' id='$lastid'");   $user_res = mysql_query("select * users id='$id'"); if(mysql_num_rows($user_res) == 0) {     $user_res = mysql_query("select * subscribers id='$id'"); }  $user_row = mysql_fetch_array($user_res);  $username = ucfirst($user_row['name']); $phone = $user_row['mobile']; $date = date("d m y",time()); }  $message = "dear " . $username . ", 1 time login code " . $date . " " . $code; $data = array(     'username' => 'trdnif',     'password' => 'trade123',     'from' => 'trdnif',     'to' => $phone,     'udh' => "",     'dlr-mask' => 19,     'dlr-url' => "",     'text' => $message );  $request = new http_request2("http://myvaluefirst.com/smpp/sendsms", http_request2::method_get); $url = $request->geturl(); $url->setqueryvariables($data); try {     $response = $request->send();     if (200 == $response->getstatus()) {         //echo $response->getbody();     } else {         //echo 'unexpected http status: ' . $response->getstatus() . ' ' . $response->getreasonphrase();         echo "";     } } catch (http_request2_exception $e) {     //echo 'error: ' . $e->getmessage(); }  ?> 

you need endpoint on server side both website , app can post username , password , in response access code.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -