• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps PHP and android

dear all, i am a beginner in android

i have a website that contains forms and send mails using PHP, also at the same time the data will be saved into my database.

and at the same project i have a login form with username and password which check my database and if the username and password matches changes will appear in home page

my problem is that i need to make android application for my php website

i want to know what is the best way to make this application??
i want to use my php website as an application like facebook application.. but i dont know how.. can u put me in the right way coz i am a beginner in android
 
I use php for one of my appshttps://play.google.com/store/apps/details?id=com.novaspirit.portabletoolkit
how i ended up doing it was programming my php to output in xml format then having my android app parse the xml.

Code:
$results = mysql_query($sql);
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<apps>\n";
$sSyntax = array("<", ">", "&", "'", "\"");
$rSyntax = array("&lt;", "&gt;", "&amp;", "&apos;", "&quot;");
echo "<app>\n";

$aString = "";
$dString = "";
while ($row=mysql_fetch_array($results)) {
	$appName = $row["appName"];
	$appDescrip = $row["appDescription"];
	$appDescription = str_replace($sSyantax, $rSyantax, $appDescrip);
	$aString = $appName;
	$dString =  $appDescription;
	$appVersion = $row["appVersion"];
	$appLocation = $row["appLocation"];
	$appDefinition = $row["appDefinition"];
	$zipContent = $row["zipContent"];
	$appFileName = $row["appFileName"];
	$appSize = $row["appSize"];
	
	}	
echo "<appName data = \"" . $aString . "\"/>\n";
echo "<appDescription data = \"" . $dString . "\"/>\n";
echo "<appVersion data = \"" . $appVersion . "\"/>\n";
echo "<appLocation data = \"" . $appLocation . "\"/>\n";
echo "<appDefinition data = \"" . $appDefinition . "\"/>\n";
echo "<zipContent data = \"" . $zipContent . "\"/>\n";
echo "<appFileName data = \"" . $appFileName . "\"/>\n";
echo "<appSize data = \"" . $appSize . "\"/>\n";
echo "</app>\n";
echo "</apps>\n";
?>

results when pulling

Code:
<?xml version="1.0" encoding="UTF-8"?>
<apps>
<app>
<appName data = "Spybot"/>
<appDescription data = "Detects and removes tens of thousands of spyware and similar malware from PCs. It can also clean usage tracks and fix registry issues. Spybot is freeware for personal use. Many cleaning and immunization features require admin rights, which will be requested on launch."/>
<appVersion data = "1.6.2"/>
<appLocation data = "http://www.spybotupdates.com/files/spybotsd162.exe"/>
<appDefinition data = ""/>
<zipContent data = "N"/>
<appFileName data = "spybotsd162.exe"/>
<appSize data = "15#:15#:"/>
</app>
</apps>

hope this helps. i don't know if this is the best way to do it but it was pretty easy and straight forward for me
 
If you program your php to output in JSON (there is a built in php function to do this) it will be even easier than xml. Id provide a link to an example, but im on my mobile at the moment.
 
If you program your php to output in JSON (there is a built in php function to do this) it will be even easier than xml. Id provide a link to an example, but im on my mobile at the moment.

not to hijack the thread lol. i'll look into that JSON thanks
 
Back
Top Bottom