-1

I have a script that is written in PHP but I need to make it into an android app. How do I get the same result?

$url = "http://54.193.106.113/ING004/android1/WebServer/Web/sogame/newControl/nmMail/getMailList?    sign=".strtoupper($sign);

$connection = curl_init($url);
curl_setopt($connection, CURLOPT_POSTFIELDS, $finalData);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($connection, CURLOPT_ENCODING, "gzip");

$result = curl_exec($connection);

$err = curl_error($connection);

$baseObj = json_decode($result, true);  

curl_close($connection);
Nifty62
  • 92
  • 1
  • 11

1 Answers1

0

I am admittedly new to the world of Android, but it looks like what you're trying to do is an HTTP request that returns a collection of data (e.g. a list of emails on a mailing list). I've implemented similar functionality (just not with Android) and I would strongly suggest looking into something at least a little cleaner for your URL structure (google REST URLs).

That said, here are a few things I've found that hopefully will help you:

Make an HTTP Request with Android

Article on integrating a REST API into Android

Hope that helps.

Community
  • 1
  • 1
macinnir
  • 71
  • 1
  • 3