模拟提交的问题
浏览器显示的
参数为:
method GET
model {"searchString":"B0036SGFB6","lang":"ja_JP","marketPlace":"A1VC38T7YXB528"}
源代码为:
method=GET&model=%7B%22searchString%22%3A%22B0036SGFB6%22%2C%22lang%22%3A%22ja_JP%22%2C%22marketPlace%22%3A%22A1VC38T7YXB528%22%7D
请问curl_setopt($ch, CURLOPT_POSTFIELDS, $data)中的$data应该怎么写呢?
回复讨论(解决方案)
$data 是一个关联数组就可以了,关联键就是表单控件的 name
xuzuning大大:
我现在是这样的
$data='method=GET&model='.urlencode('{"searchString":"B0036SGFB6","lang":"ja_JP","marketPlace":"A1VC38T7YXB528"}');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
得到了我想要到结果,但现在有个问题:
$data_ar=array(
"searchString"=>"B0036SGFB6",
"lang"=>"ja_JP",
"marketPlace"=>"A1VC38T7YXB528"
);
请问我怎么把$data_ar提交出去呢??
我想提交数组出去,而不是一段死的字符串
$data_ar=array(
"searchString"=>"B0036SGFB6",
"lang"=>"ja_JP",
"marketPlace"=>"A1VC38T7YXB528"
)请问我怎么把$data_ar提交出去呢??;
得到的结果,我用print_r($value)的内容:
{"data":[{"link":"http://www.amazon.co.jp/gp/product/B0036SGFB6/ref=xx_xx_cont_xx/378-0276217-1847765","dimUnits":"センチメ?トル","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":"キログラム","productGroup":"147","weight":"0.0998","asin":"B0036SGFB6","whiteGlovesRequired":"N","title":"ELECOM USB2.0ケ?ブル A-Bタイプ 2m ブラック U2C-B20BK [Personal Computers]"}],"errorMessage":null}
这不是一个数组吗?为什么$value[0]或$value["data"]没有内容输出??
你 print_r($value) 得到的是 json 串
需要用 json_decode 解码后才可使用

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



MySQL transaction processing: the difference between automatic submission and manual submission. In the MySQL database, a transaction is a set of SQL statements. Either all executions are successful or all executions fail, ensuring the consistency and integrity of the data. In MySQL, transactions can be divided into automatic submission and manual submission. The difference lies in the timing of transaction submission and the scope of control over the transaction. The following will introduce the difference between automatic submission and manual submission in detail, and give specific code examples to illustrate. 1. Automatically submit in MySQL, if it is not displayed

Machine learning makes computer graphics (CG) simulations more realistic! The method is called Neural Flow Maps (NFM), which can accurately simulate smoke with four vortices: more complex ones can also be easily realized: you know, in this era of AI applications flying all over the sky, CG physics simulation is still It is the world of traditional numerical algorithms. △NFM simulates "leapfrog". Although the application of neural networks in CG can create dazzling visual effects, it cannot strictly and robustly describe physical properties. △NFM simulates "ink droplets" It is precisely for this reason that physical simulation based on neural networks is still in the proof of concept stage, and the effects generated are far from SOTA. In order to solve this complex problem,

Transformer has become a popular choice for various machine learning tasks and has achieved great results, so how else can it be used? Researchers with great imagination actually want to use it to design programmable computers! The authors of this paper, titled "Looped Transformers as Programmable Computers", are from Princeton University and the University of Wisconsin, and aim to explore how to use Transformers to implement general-purpose computers. Specifically, the authors propose a framework for using transformer networks as general-purpose computers by programming them with specific weights and placing them in loops. in this framework

Tips for implementing form validation and submission with PHP and UniApp Introduction: When developing web pages or mobile applications, form validation and submission are essential functions. Form validation is used to check whether the data entered by the user conforms to specific rules, and submission saves or sends the data entered by the user to the server. This article will introduce the techniques of using PHP and UniApp to implement form validation and submission to help developers quickly implement front-end and back-end interaction functions. 1. PHP implements form validation. The following is a PHP form validation sample code for

Introduction to git Git is a distributed version control system, which means that each developer has a complete copy of the code base on their computer. This is different from a centralized version control system (such as Subversion or Perforce), which only has a central code repository. The benefit of distributed version control is that it makes collaboration more efficient because developers can work offline and synchronize with the central code base later. Installing Git To use Git, you need to install it on your computer first. You can download the installer for your operating system from the official Git website. After the installation is complete, you can enter git --version in the command line to check whether the installation was successful. Git basic concepts repository: Git

How to handle complex form submissions in Vue requires specific code examples. In Vue, to handle complex form submissions, you can use Vue's form processing methods and other related plug-ins or features to simplify the development process. This article will introduce how to use Vue and some other common plug-ins to handle complex form submissions, and provide specific code examples. 1. Two-way binding of form data One of the core features of Vue is the two-way binding of data. In form processing, we can use Vue instructions to achieve bidirectional communication between form data and views.

Recently, Samsung announced the acquisition of Oxford Semantic Technologies, a British knowledge graph startup, to enhance its local AI capabilities and provide users with a more personalized AI experience. The company's main product is the AI engine RDFox, which uses knowledge graph technology to store information as an interconnected network. The way it processes data is similar to how humans think: acquiring, memorizing, recalling and reasoning about knowledge. This technology will enhance the device's understanding of the products or services used by users, thereby enabling rapid information retrieval and recommendations. It is understood that Oxford Semantic Technologies was founded in 2017 by three Oxford University professors: Ian Horrocks, Boris Mortick and Bernardo Cuenca.

PHP and WebDriver extensions: How to simulate users' scrolling and dragging behaviors. With the continuous development of network applications, more and more websites and applications need to simulate users' scrolling and dragging behaviors. This is very important for testers and developers to ensure that websites and applications work properly in various scenarios. In this article, we will introduce how to use PHP and WebDriver extensions to simulate user scrolling and dragging behavior. WebDriver is a tool for automating browsers,
