post from iphone to php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
quique
Forum Newbie
Posts: 5
Joined: Tue Feb 23, 2010 6:40 am

post from iphone to php

Post by quique »

im posting from iphone to php server file that will write to mySQL db. Ive got the post in %20 format and it looks like this:

status:tagid=F6869FB4,latitude=37.331689,longitude=-122.030731

but im not sure how to post it. Ive got the manual user input form.html laid out and the corresponding write.php file. But the values are not getting posting, how should i encode them or format them for the write.php file to receive them?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: post from iphone to php

Post by s.dot »

You can use the header() function to post data.

Code: Select all

$req = "yourdatahere";
header("POST /yourscript.php HTTP/1.0");
header("Host: http://www.yourdomain.com");
header("Content-Type: application/x-www-form-urlencoded");
header("Content-Length: " . strlen($req));
header($req);
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
quique
Forum Newbie
Posts: 5
Joined: Tue Feb 23, 2010 6:40 am

Re: post from iphone to php

Post by quique »

scottayy wrote:You can use the header() function to post data.

Code: Select all

$req = "yourdatahere";
header("POST /yourscript.php HTTP/1.0");
header("Host: http://www.yourdomain.com");
header("Content-Type: application/x-www-form-urlencoded");
header("Content-Length: " . strlen($req));
header($req);

Hmm...No sure what you mean. Im sending info from the iphone to the php file that writes to mySQL...
Post Reply