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 6042203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:45:51+00:00 2026-05-23T06:45:51+00:00

I have an iphone application that gets data from a set of php files.

  • 0

I have an iphone application that gets data from a set of php files.
The php files return XML based on the query string parameters.
What would be the best way to secure and restrict access to these “web services”?

Thank you!

Edit: The server is running CentOS/Apache and I would like to limit access so that only the application will be able to access the files. I don’t want the files to be accessible from outside of the application. (The application will be ported to android and blackberry as well).

  • 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-23T06:45:51+00:00Added an answer on May 23, 2026 at 6:45 am

    You could generate a hash in your iPhone application that gets passed along with the other query strain parameters. The hash should include a “key” (or “shared secret”) that’s only known by the web server and the iPhone application as well as one or more of the query string parameters that are passed.

    The PHP script that will receive the information can then regenerate the hash since it knows the “key”. If the “key” matches the one in the query string, the request is valid and came from an iPhone, otherwise it didn’t.

    Update: To prevent someone from using the same query string to request the same information over and over again, you can add an “expiry” timestamp to the query string and hash and check that the request hasn’t expired if the hash is valid.

    I can’t provide an Objective-C but your PHP script could look like this:

    <?php
    
    $hash = md5('SHAREDSECRET'.$_REQUEST['expiry'].$_REQUEST['param1'].$_REQUEST['param2']);
    
    if ( $hash != $_REQUEST['$hash'] || time() > $_REQUEST['expiry'] )
      die('Invalid request.');
    
    // Some additional code here for valid requests.
    
    ?>
    

    Based on the example above, you’d want the iPhone application to create an MD5 hash of the shared secret (“SHAREDSECRET” in this case), “param1”, and “param2” and include it in the request to the PHP file.

    The URL that the iPhone requests should look like this:

    http://example.org/file.php?hash=value&expiry=timestamp&param1=value&param2=value
    

    Of course the “key” itself wouldn’t be passed in the query string making it difficult for someone to figure out how to get to your information (unless it through the iPhone app of course).

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

Sidebar

Related Questions

I'm currently writing an iPhone application which gets some data from the user and
I have an iPhone application with a settings.bundle that handles various settings for my
I have an application that works some what similar to how iPhone's Contact application
I have created an iPhone application based on an OpenGL view. Now I would
In an iPhone app I'm developing, I grab a set of data from a
I am writing an iPhone application that needs to record audio from the built-in
I have an iPhone application that has a user preference page where the user
I currently have an iPhone application that makes a call to an API to
I have an application that is loading html from a remote server in a
I have a data entry form in a HTML5 application that users will be

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.