JSON, URL-encode, and UTF-8

J. Landman Gay jacque at hyperactivesw.com
Fri Aug 21 00:15:03 CEST 2015


Okay, addendum: It works fine in LC 6.7.6. It fails entirely in 7.0.6.

I wish I'd tried that sooner. We need 7.x because of the unicode support.


On 8/20/2015 4:53 PM, J. Landman Gay wrote:
> I'm still struggling with this. I have a valid JSON string, verified by
> a web-checking site and by the PHP developer. He wants me to POST it
> this way:
>
> json=<JSON string>
>
> It doesn't work. He says the server receives it but it is not passed to
> the PHP script because the main parameter is empty. Here's what I do:
>
>    set the httpHeaders to "content-type: application/json"
>    put convertToJSON() into tData -- produces valid JSON
>    put "json=" before tData
>    post tData to kServerURL
>
> The result is empty. The developer has set up the PHP to return the
> values back to me for testing, but "it" is also always empty. He says
> this means there is no "main parameter", but he also said adding "json="
> to the front would provide that, he will just grab the params from what
> follows.
>
> The URL is https if that matters. I have also tried URLEncoding the JSON
> but it didn't help. I also tried removing the custom header.
>
> He pointed me to this web site: <https://www.hurl.it/> When I set it to
> send JSON and enter the same params there, it POSTs successfully to the
> server.
>
> How would you POST a JSON string to a PHP script on a secure server?
>


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list