Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble getting simple POST from Objective C to PHP working
    text
    copied!<p>I'm a total newbie at PHP, but this seems so simple, there doesn't seem like any way for me to be screwing this up, unless I'm COMPLETELY misunderstanding the way all of this works.</p> <p>Objective-C:</p> <pre><code>ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://myurl.com"]]; [request setPostValue:@"test value A" forKey:@"testA"]; [request setPostValue:@"test value B" forKey:@"testB"]; [request setDelegate:self.delegate]; [request startAsynchronous]; </code></pre> <p>PHP:</p> <pre><code>&lt;?php $testValueA = $_POST['testA']; $testValueB = $_POST['testB']; echo "Value A = $testValueA, Value B = $testValueB"; ?&gt; </code></pre> <p>When I <code>NSLog</code> the return string from the <code>request</code>, I get <code>Value A = Value B =</code>. Is this an error in my poorly understood PHP implementation, or is there an issue with the Objective-C?</p> <h2>--EDIT--</h2> <p><code>print_r($_POST)</code>, <code>var_dump($_POST)</code>, and <code>$HTTP_RAW_POST_DATA</code> all return nothing. So I'm assuming that the problem lies in <code>ASIFormDataRequest</code>?</p> <h2>--EDIT 2--</h2> <p>Dumped the headers from the response:</p> <pre><code>Connection = "Keep-Alive"; "Content-Type" = "text/html"; Date = "Thu, 04 Nov 2010 20:05:39 GMT"; "Keep-Alive" = "timeout=2, max=199"; Server = Apache; "Transfer-Encoding" = Identity; "X-Powered-By" = "PHP/5.2.14"; </code></pre> <p>Not sure what to do with this info.</p> <h2>--Edit 3--</h2> <p>Getting this log message from the error file:</p> <pre><code>"(Notice) Undefined index: testA" </code></pre> <p>Also one for <code>testB</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload