1

My ios app have to send/retrive some date throught some php pages. This is an example call usingi STHTTPRequest :

 __block STHTTPRequest *up = [STHTTPRequest requestWithURLString:[NSString stringWithFormat:@"%@%@",PATHSERVER,@"retrivedata.php"]];

up.encodePOSTDictionary=NO;
up.postDataEncoding=NSUTF8StringEncoding;

up.POSTDictionary = @{@"name":@"Name", @"surname":@"Surname"};

It's all ok until i decide to insert something lik :

up.POSTDictionary = @{@"name":@"Na&me", @"surname":@"Surname"};

In this way a

 print_r($_POST);

in retrivedata.php results in:

Array
(
 [name] => Na
 [surname] => Surname

)

The name is cutted at the "&" char index. I have tried with no success something like:

utf8_encode/utf8_decode($name)

It seems that name arrives to retrivedata.php already cutted, so i can't use any chars conversion/encoding... In my STHTTPRequest i have already tried to set:

up.encodePOSTDictionary=YES;

With this setting i can send "&" as $amp; but if i do a SELECT to retrive the value i can't convert it to the normal string by

 html_entity_decode();

it still remain

&

How i can do? My STHTTPRequest send 'Na&me' but it comes blank to $_POST[] in retrivepage.php

user31929
  • 1,115
  • 20
  • 43

1 Answers1

1

I am not really familiar with the shttprequest, but you should url encode it. It will look like "Na%26me" when URL encoded. Later in the post you will have "Na&me"

Hope it helps :)

Angel Iliikov
  • 710
  • 5
  • 8