Code-Undefinedvariable '$ HTTP_RAW_POST_DATA

Source: Internet
Author: User
The following is my program: after sending a request package, I have $ HTTP_RAW_POST_DATA in tmp.txt, but the page displays parsexmlstringerror! Go back and check the code. a warning is displayed on $ HTTP_RAW_POST_DATA: Undefinedvariable & #39; $ HTTP_RAW_POST_DATA. on the Internet, I checked that it was changed to php. ini, I checked php in Windows. ini, indeed "always_populate_raw_post_dataOn" (is it code-based xmlphp data?

The following is my program:
After sending a request packet, I found $ HTTP_RAW_POST_DATA in tmp.txt, but the page displays parse xml string error! Go back and check the code. a warning is displayed on $ HTTP_RAW_POST_DATA: Undefined variable '$ HTTP_RAW_POST_DATA. on the Internet, check whether it is php. ini, I checked php in Windows. ini, it is indeed "always_populate_raw_post_data = On" (isn't it a semicolon or a comment? Is it necessary to remove the semicolon? I can't even try it), but it doesn't work.
After refreshing the web page, the value in tmp.txtbecomes null, and the request is sent again with data in tmp.txt. However, the web page cannot be displayed and must be refreshed. Once refreshed, T ^ T is used. could you tell me how to change it? thank you?

**

// Obtain POST data and GET data (use Fiddler to send a POST request packet to test2.php)

File_put_contents ("D: \ Program Files (x86) \ AppServ \ tmp.txt", var_export ($ _ GET, true), FILE_APPEND );
Echo"
";
File_put_contents ("D: \ Program Files (x86) \ AppServ \ tmp.txt", "\ n", FILE_APPEND );
Echo"
";
File_put_contents ("D: \ Program Files (x86) \ AppServ \ tmp.txt", var_export ($ HTTP_RAW_POST_DATA, true), FILE_APPEND );

// Parse $ HTTP_RAW_POST_DATA and output the parsed data
$ PostXmlStr = $ HTTP_RAW_POST_DATA;
$ XmlObj = simplexml_load_string ($ postXmlStr );
If (false ===$ xmlObj)
{
Echo "parse xml string error! \ N ";
Exit (0 );
}
$ ToUser = $ xmlObj-> ToUserName;
Echo "to User:". $ toUser. "\ n ";

?>

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.