0

I currently have the following code

-(void)returnToSQL
{
    NSURL *url = [NSURL URLWithString:@"http://babyfood.30ptdesign.com\....php"];

    NSData *dataUrl = [NSData dataWithContentsOfURL:url];

    NSString *strResult = [[NSString alloc] initWithData:dataUrl encoding:NSUTF8StringEncoding];
    NSLog(@"%@",strResult);
}

I need to pass an NSString named _username into a variable of the same name in the PHP file, without using ASIFormDataRequest.

Is there any way to do this? I haven't been able to find any.

jscs
  • 63,694
  • 13
  • 151
  • 195
  • Look into NSURLRequest and NSURLConnection and be sure to read up on GET and POST requests. – Mario Jun 17 '14 at 19:47

1 Answers1

0

Call your php with parameters.

Something like this

http://domain/file.php?param=string

and in your php

<?php
  $param = $_GET['param'];
  echo $param;
?>
Akaino
  • 1,025
  • 6
  • 23
  • This works perfectly for the first variable, thanks! How can I add a second variable on? Ie. http://domain/file.php?param1=string1?param2=string2 does not work. How would I write that? – Nick Martino Jun 17 '14 at 20:17
  • There are possibilities to do so. However I didn't try that myself but it should be something like this: http:// domain/test.php?param1=param1&param2=param2&param3=param3 Always remember to avoid sql injection when using with databases! There are several tutorials out there! :) – Akaino Jun 17 '14 at 21:07