ASIHTTPRequest Php Example - Php

How to post a string to a php file using ASIHTTPRequest ?

Snippet Code


  
Rate this page :
  [ 0 votes]

Displayed below a simple application that posts a string to a php file using ASIHTTPRequest in Objective C.

OBJECTIVE-C CODE : ---------------------- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *path = [paths objectAtIndex:0]; [path stringByAppendingPathComponent:[pieces objectAtIndex:indexPath.row]]; NSURL *url = [NSURL URLWithString:@"http://192.168.1.102:8888/upload.php"]; ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease]; [request setFile:path forKey:@"$string"]; PHP Code : ------------ <?php $string = 'Welcome"; ?>

Tags


Ask Questions

Ask Question