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

  • Home
  • SEARCH
  • 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 6720281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:11:38+00:00 2026-05-26T09:11:38+00:00

I have a tested and working php script that pulls from a db and

  • 0

I have a tested and working php script that pulls from a db and returns as an XML.
I have used ASIHTTPRequest to make a POST to the php script successfully.
I have looked for online help to get this to work. From what I understand, all the code is solid. It compiles properly, runs without problem, even makes the request without problem. I get no errors.
Since I have thoroughly tested and successfully used the php, I assume the break is on the iPhone side.

I do not understand why it does not download the XML file to the specified location.
Any insight would be greatly appreciated.

// Create the request
NSURL *url=[[NSURL alloc]initWithString:@"http://localhost:8888/Project/script.php"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url]retain];

// gather *ALL* data present
if ( [txtEmail.text length] > 0 )
    [request setPostValue:txtEmail.text forKey:@"email"];
if ( [txtFName.text length] > 0 )
    [request setPostValue:txtFName.text forKey:@"firstname"];
if ( [txtID.text length] > 0 )
    [request setPostValue:txtID.text forKey:@"id"];
if ( [txtLName.text length] > 0 )
    [request setPostValue:txtLName.text forKey:@"lastname"];

[request setDidFailSelector:@selector(requestFailed:)]; 
[request setDidFinishSelector:@selector(requestDone:)]; 

[request setDownloadDestinationPath:@"/Library/Project/dbInfo.xml"]; 
[request setDelegate:self]; 
[request startSynchronous]; 
[request release];
[url release];
  • 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-26T09:11:38+00:00Added an answer on May 26, 2026 at 9:11 am

    a few points on your code:

    1. Why are you using a POST request to download a file? usually downloading is done via a GET request (if we’re talking REST). You could use a simple ASIHTTPRequest + adding your post values as URL-Parameters (+ handle it on the php side accordingly).

    2. you are allocating and retaining your ASIFormDataRequest instance, but only releasing it once -> results in a memory leak. (for every alloc/copy/retain -> release it).

    To answer you question:
    i think the downloadDestinationPath is wrong (the application has no permissions to write there).
    Better:

    NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    NSString *path = [docDir stringByAppendingPathComponent:@"dbInfo.xml"];
    [request setDownloadDestinationPath:path];
    

    Now your “dbInfo.xml” File is saved in the documents folder of your application.
    If you’re running your app in the simulator, you can find the directory at:
    ~/Library/Application Support/iPhone Simulator/IOS_SDK_VERSION/Applications/APP_UID/Documents

    And:
    if you implement the downloadProgressDelegate: request:didReceiveBytes: method, you can check if you’re actually receiving data:

    -(void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes {
      NSLog(@"received bytes ..") ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some PHP code that was at one point WORKING FINE. It makes
I am working on a PHP script that automatically displays an image based on
I have a blowfish encryption script in PHP and JAVA vice versa that was
I have tested the below script on a demo page which is not using
I have a secured (https) XML-RPC server written in python, and I have tested
I having an issue from my HTTP Post. The code I'm using are working
I am working on a PHP upload script which allows uploading only PDF files.
So I have an extremely simple $.post function that works perfectly in all the
I am currently working on a web application that uses PHP and MySQL, but
Below is a snippet of PHP that I need to get working, I need

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.