Q:

HTTP POST from Android to PHP not working for certain domain

I am trying to send data from an Android app to a PHP file on my server (school server) but I'm running into some problems. I have my own hosting space through SimpleHelix, and I was able to send the data just fine, but when I try to use my school's server, the PHP program returns the following error:
Notice: Undefined index: message in /home/alespurg/test_good.php on line 4

Warning: file_put_contents(androidmessages.html) [function.file-put-contents]: failed to open stream: Permission denied in /home/alespurg/test_good.php on line 9

Warning: file_get_contents(androidmessages.html) [function.file-get-contents]: failed to open stream: No such file or directory in /home/alespurg/test_good.php on line 11

All I have changed in my Java file is the URL that I need it to post to. Could there be restrictions on my school's server that prevent the post to go through? I've checked my permissions on the folders and files, they're all 775. Again, I know the program works, I'm just having problems with the server. I did not use the IP address of the domain for either one. I couldn't find it for my school's server. 
EDIT: 
<?php
// get the "message" variable from the post request
// this is the data coming from the Android app
$message=$_POST["message"];

// specify the file where we will save the contents of the variable message
$filename="androidmessages.html";
// write (append) the data to the file
file_put_contents($filename,$message."<br />",FILE_APPEND);
// load the contents of the file to a variable
$androidmessages=file_get_contents($filename);
// display the contents of the variable (which has the contents of the file)
echo $androidmessages;
?>

A:

If the permissions are 775 that means that if the web server process isn't either (1) the user who owns /home/alespurg/ (not likely) or (2) a member of the group that owns /home/alespurg/ (also not likely) then it won't be able write to the directory.
Are you sure the web server process is the owner or a member of the ownership group for /home/alespurg/?
I'll assume your web server is apache, which usually runs as apache:apache or nobody:nobody. Judging from the directory structure, it's likely that /home/alespurg/ is owned by alespurg:alespurg or some derivation.

ADDENDUM
If you need to do things like this an apache process is not really the appropriate place. You may not know it but you can write php scripts and execute them from the shell environment on your server where you're logged in as the appropriate user to write to that directory. Further, you can have CRON run them for you if necessary. The web server process is an unnecessary middleman.

