Questions about sending JSON data using the POST method

Source: Internet
Author: User
Questions about sending JSON data using the POST method.
This post was last edited by jxflll on 2015-04-07 16:36:47

Stream_context_create uses this function post method to send an example of a JSON object. Some trouble sending the code up. Thank you, sir. Don't use curl.
------to solve the idea----------------------
Don't know your specific needs, give a snippet of code

$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);
  • 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.