So, while looking up how to run a php script from an android app, I came across this code:
final String url = "http://example.com/creatd.php?nm=mytest";
HttpClient client = new DefaultHttpClient();
try {
client.execute(new HttpGet(url));
Intent intent = new Intent(this, Main.class);
startActivity(intent);
} catch(IOException e) {
//do something here
}
Originally, I assumed that this would work because the client.execute executes the script in the url. However, what I did not realize until now was the HttpGet gets information from running the script. My PHP script does not provide information. It merely executes a task on the server(correct me if I am wrong on the Httpclient).
How would I make it so the client.execute merely executes the script instead of also trying to get information from it? I am assuming the reason why my app crashes is since the script does not return any information the value is null.
PHP Code:
<?php
$str = $_GET['nm'];
mkdir($str,0700);
fopen($str."/".$str.".meb", "w");
file_put_contents($str."/".$str.".meb", "Hello, world!", FILE_APPEND | LOCK_EX);
?>
EDIT: Just a question, why do people keep downvoting my questions? I researched my question and tried to use solutions, but the solutions provided didn't work. What am I doing wrong?