php - Connecting android to a local server using XAMPP -


i'm trying fetch data local server android device, using free online hosting service worked fine before encountered non-related technical issues, it's not problem lies in code itself(just thought). anyway, when migrated local server using xampp, no response on app of ever, accessed php file mobile's browser , it's giving right results, app gives complete silence. searching through so, questions mentioned putting right ip address in file's url. i'm using volley , i've inserted same url with accessed file in browser, server doesn't seem respond @ all.

here's php code i'm using:

<?php   include 'dbconnect.php'; $searchterm='d'; $query = $conn->prepare('select term,id tag term :searchterm'); $query->execute(array(':searchterm'=>$searchterm.'%')); $result=$query->fetchall(pdo::fetch_assoc); echo json_encode(array('result'=>$result)); ?> 

i'm using volley library contact server, first file customeautocompletetextviewtextchangedlistener.java

@override     public void ontextchanged(charsequence s, int start, int before, int count) {         try {             networkrequsts networkrequsts = new networkrequsts(context);             networkrequsts.tagsjsonobjectrequest("https://192.168.110.1:8080/register.php");         }         catch (exception e)         {             e.printstacktrace();         }     } 

this request should issued, notice url, think problem since it's thing i've changed in code when changed server.

here's volley request:

networkrequsts.java

jsonobjectrequest tagjsonrequest=new jsonobjectrequest(url,tagsearchobject, new response.listener<jsonobject>() {             @override             public void onresponse(jsonobject response) {                  try {                     log.d("search term object",tagsearchobject.tostring());                     log.d("respone test", response.length()+" "+response.tostring());                     jasonarrayresponse=response.getjsonarray("result");                     for(int i=0;i<jasonarrayresponse.length();i++)                     {                         jsonobject jsonobject=jasonarrayresponse.getjsonobject(i);                         log.d("volley", jsonobject.getstring("term"));                         log.d("searchterm",register.tagsautocompletetextview.gettext().tostring());                      }                 }                 catch(jsonexception je)                 {                     je.printstacktrace();                 }             }         }, new response.errorlistener() {             @override             public void onerrorresponse(volleyerror error) {                 if (error instanceof servererror) {                     log.e("volley", "servererror");                     toast.maketext(context.getapplicationcontext(),error.getmessage(),toast.length_long).show();                 }              }          }); 

first of check whether server working perfectly, load in browser using localhost , if works without fail, change ip address system ip. check network connection properties sharing limited. of cases connection failure occurs because of sharing limited anti virus program or that. after giving permissions work


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -