PHP about the File_get_contens function to the local file transfer parameters of the problem

Source: Internet
Author: User
PHP about the File_get_contens function to the local file parameters of the problem
PHP about the File_get_contens function to the local file parameters of the problem

The source code is as follows:
$str _query = "Userid=admin&gameid=game1&serverid=server1";


$context = stream_context_create (Array (
' http ' = = Array (
' Method ' = ' POST ',
' Timeout ' = 10,
' Header ' = ' user-agent:mozilla/5.0 ' (Windows; U Windows NT 5.1; En-US) applewebkit/534.13 (khtml, like Gecko) chrome/9.0.597.98 safari/534.13\r\ncontent-type:application/ X-www-form-urlencoded\r\n ',
' Content ' = $str _query
)
));

Echo file_get_contents ("interface.php", true, $context);

?>

There are two files on the local aparche server. One is to put the above source files. One is the interface.php file.

I write the source code as above on this document. Post data to the interface.php file with file_get_contents. The result interface.php no data received.

I don't know where it went wrong. Ask Master Enlighten!!!!

------Solution--------------------
This parameter is just curl get.
------Solution--------------------
discuss

Reference:
In addition to the parameter array
Header items to be written
' Header ' = ' + ' user-agent:mozilla/5.0 (Windows; U Windows NT 5.1; En-US) applewebkit/534.13 (khtml, like Gecko) chrome/9.0.597.98 Safari/534.13\r\ncontent-type:app ...
  • 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.