0

I am designing an Android app that collects the user's information then passes over the data to a website that I am also designing. The website is then supposed to act on the data and once through it should send some result back to the app. How do I send the data collected by the app to my webpage? How do I listen for a response from the website?

e.g How to send this to website ID="234342 QuestionCode="92" TimeStamp="6757172787" I have hosted the website using Webhost000.

So far I've tried https://stackoverflow.com/a/29153585/11118152, https://stackoverflow.com/a/29381874/11118152 among other StackOverflow answers but all of them are deprecated.

The PHP code that I am using to listen for incoming requests is this

<?php
 $Response = file_get_contents('php://input');
  $logFile = "Texttestresponse.txt";
  $log = fopen($logFile, "a");

$test = (string)$Response;

  fwrite($log, $test);
  fclose($log);
  ?>
Zoe
  • 27,060
  • 21
  • 118
  • 148
Martin Mbae
  • 1,108
  • 1
  • 16
  • 27
  • Can you provide us more information? What libraries do you include in your android project? Which is your request handler in Android Studio? @Martin Mbae – Kerim Yagmurcu Mar 17 '19 at 10:44

1 Answers1

1

You can build a RestFul API, if you want to pass data from your android app to your web server.

You can use "volley library" for android.

Here is a tutorial link to begin with: https://www.androidhive.info/2014/09/android-json-parsing-using-volley/