Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6098807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:12:00+00:00 2026-05-23T13:12:00+00:00

I have an iPhone app that uses ASIHTTPRequest to post data to a php

  • 0

I have an iPhone app that uses ASIHTTPRequest to post data to a php file, which then uses sql to update the database accordingly.

What’s bugging me is I keep reading that I should encode my posted data in JSON format. Can somebody explain to me the point in this? Why should I encode in JSON format? What are the benefits, needs for this..

EDIT:

Here is how I am posting my data:

-(void) postToDB:(NSString*) msg{
    NSString *myphp = @"http://localhost:8888/databases/test.php";
    NSURL *url = [NSURL URLWithString:myphp];
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
    [request setPostValue:msg forKey:@"message"];
    [request setDelegate:self];
    [request startAsynchronous];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:12:01+00:00Added an answer on May 23, 2026 at 1:12 pm

    Encapsulating your data in a JSON structure helps creating a structured communications protocol with your server. Without going as far as this depending on your needs, take a look at the specs for JSON-RPC for example. This allows you to have a fully-defined protocol for exchanging data, where methods are always passed the same way, errors are always returned the same way too.

    The use of JSON, JSON-RPC, SOAP, or any other “envelope” is, strictly speaking, never mandatory. It’s just a good practice of standardizing communications over the wires.

    Also, I don’t know if setPostValue:ForKey: automatically escapes characters when needed, but imagine you’re sending a GET to http://whatever/get.php?nickname=nick&with?special@chars&password=qzerty.
    What happens here? your PHP script won’t be able to parse the “nickname” and “password” fields correctly.
    Encapsulating your data in JSON with the help of a JSON framework (you can turn a NSString dictionary to a JSON structure flawlessly in a single line of code) helps preventing this kind of situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPhone app that uses ASIHTTPRequest to transmit data input by the
I have an iphone app that uses Core Data to do storage. I have
I have an IPhone app that uses webservices to get data from a server.
I have an iPhone application that uses a sqlite3 database for saving data and
I have an app that uses NASA live TV stream for the iphone/ipad which
I have an iPhone app which uses ASIHTTPRequest to communicate to a REST service
I am reading data from an IPhone App that uses http POST to transfer
I have an iPhone app that uses core.data as its storage and a rest
I have an iPhone app that uses the json-framework . I moved some of
I have written an iPhone app that uses the iPhone's relative GPS location. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.