JSON, URL-encode, and UTF-8

J. Landman Gay jacque at hyperactivesw.com
Thu Aug 20 17:53:50 EDT 2015


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