Simulate the submitted question. the browser displays
Parameters:
Method GET
Model {"searchString": "B0036SGFB6", "lang": "ja_JP", "marketPlace": "A1VC38T7YXB528 "}
Source code:
Method = GET & model = % 7B % 22 searchString % 22% 3A % 22B0036SGFB6% 22% 2C % 22 lang % 22% 3A % 22ja_JP % 22% 2C % 22 marketPlace % 22% 3A % 22A1VC38T7YXB528% 22% 7D
How do I write $ data in curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data?
Reply to discussion (solution)
$ Data is an associated array, and the associated key is the name of the form control.
Xuzuning:
I am like this now
$ Data = 'method = GET & model = '. urlencode ('{"searchString": "B0036SGFB6", "lang": "ja_JP", "marketPlace": "A1VC38T7YXB528 "}');
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data );
I want to get the result, but now there is a problem:
$ Data_ar = array (
"SearchString" => "B0036SGFB6 ",
"Lang" => "ja_JP ",
"MarketPlace" => "A1VC38T7YXB528"
);
How can I submit $ data_ar ??
I want to submit an array instead of a dead string.
$ Data_ar = array (
"SearchString" => "B0036SGFB6 ",
"Lang" => "ja_JP ",
"MarketPlace" => "A1VC38T7YXB528"
) How can I submit $ data_ar ??;
The result is as follows:
{"Data": [{"link": "http://www.amazon.co.jp/gp/product/B0036SGFB6/ref=xx_xx_cont_xx/378-0276217-1847765", "dimUnits": "Too many bytes? Commandid "," thumbnail ":" https://images-na.ssl-images-amazon.com/images/ I /41zK5Evzv2L._SL80_.jpg "," subCategory ":" 14700954 "," dimensions ": {" width ": 7.3914," length ": 20.8026, "height": 2.794}, "gl": "gl_pc", "image": "https://images-na.ssl-images-amazon.com/images/ I /41zK5Evzv2L._SL120_.jpg", "weightUnits": "Too many other variables", "productGroup ": "147", "weight": "0.0998", "asin": "B0036SGFB6", "whiteGlovesRequired": "N", "title": "ELECOM USB2. 0 bytes? Too many A-B too many 2 m too many others U2C-B20BK [Personal Computers] "}]," errorMessage ": null}
Isn't this an array? Why is there no content output for $ value [0] or $ value ["data ??
What you get from print_r ($ value) is a json string.
Json_decode can be used only after decoding.