Simulate submitted problems

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.