The POST method is used to send JSON data. At the end of this POST, the example of stream_context_create being edited by jxflll in 2015-04-0716: 36: 47 sends a json object using the POST method of this function. Some of them have trouble sending code segments. Thank you. Do not use curl ------ to solve the problem that the POST method is used to send JSON data.
This post was last edited by jxflll at 16:36:47 on
Stream_context_create uses the POST method of this function to send an example of a json object. Some of them have trouble sending code segments. Thank you. Do not use curl
------ Solution ----------------------
I don't know your specific requirements. just give a code snippet.
$ Opts = array (
'Http' => array (
'Method' => 'post ',
'Header' => 'Content-type: application/x-www-form-urlencoded ',
'User _ agent' => $ _ SERVER ['http _ USER_AGENT '],
'Content' => http_build_query ($ data)
)
);
$ Context = stream_context_create ($ opts );
$ Result = file_get_contents ($ url, false, $ context );