Data | problem
Document Version
Version creation time creator note 1.0.0606.12003-6-6 Zheng first draft
Implementation Scope:
This document will explain the data issues that the PHP page receives from the HTTP component post. In general, POST the binary data stream, only need PHP with $http_raw_post_data can receive. However, this is not the case that we have encountered. Before continuing to read, we assume you are familiar with the following knowledge: N phpn MSXML2. SERVERXMLHTTPN HTTP POST
Phenomenon
we have this problem: I post binary data streams from Windows 2000 using the Msxml2.serverxmlhttp interface to the PHP page under Linux apche. The $http_raw_post_data variable for the PHP page is empty, the data is not available, and the value of sizeof ($_post) is also 0. However, if I POST data to a PHP page under Windows $http_raw_post_data IIS, I can receive normal data with the same. Why is there such a difference?
Environmental information
Initiating HTTP POST requester-system environment
Windows XP Professional (Service Pack 1) MSXML3.Dll (SP3/version number: 8.30.9926.0) The code to invoke ServerXMLHTTP is: msxml2::iserverxmlhttprequestptr pixmlhttprequest = null; HRESULT hr = pixmlhttprequest.createinstance ("MSXML2.") ServerXMLHTTP "); hr = Pixmlhttprequest->open (L" POST ", Bstrphpurl, variant_false, //synchronous Send vtmissing, vtmissing); hr = pixmlhttprequest->send (vardata);
PHP for MS Windows System environment for correctly receiving post requests
PHP for Windows installation information that normally receives data with $http_raw_post_data: PHP Version 4.2.2SystemWindows NT 5.1 build 2600Server APICGI Related settings for using this global variable: directivelocal valuemaster valuealways_populate_raw_post_data00
Unable to receive POST request PHP for Linux system environment
PHP for Linux installation information that $http_raw_post_data receive POST data: PHP Version 4.3.2rc3system Linux atm2 2.4.18-1 #1 Wed May 29 10:45:2 3 CST 2002 i686 Server API Apache registered PHP Streams PHP, HTTP, FTP related settings for using this global variable: directivelocal valuemaster valueal Ways_populate_raw_post_dataonon
More information
logically said, as long as the php.ini defined; Always populate the $HTTP _raw_post_data variable.always_populate_raw_post_data = On can be used to receive data entirely with $http_raw_post_data variables. At least the $_post variable can be used to calculate the size of the data post to the page. I did see a few people trying to report "Empty $HTTP _raw_post_data" is a PHP bug, but the PHP maintainer says it's definitely not.
Resolution Steps
Do not know how the PHP 4.2.2 under Windows can always receive. But if I explicitly declare content-type as file, the PHP 4.3.2RC3 under Linux can receive post data normally. The code for setting header information is as follows: hr = Pixmlhttprequest->setrequestheader ( _bstr_t ( "Content-type"), _bstr_t ("file"); do so, PHP 4.2.2 for Windows and PHP 4.3.2rc3 for Linux can all be $http_raw_post_data receive, no problem.
Summarize:
If your $http_raw_post_data is not there, you can specify Content-type as file when you call the HTTP component to send an HTTP POST request.
Disclaimers:
the information contained in this document represents the current view of Zhengyun on the issues discussed at the date of release. This document should not be construed as a commitment by the Zhengyun party, Zhengyun does not guarantee the accuracy of the information given after the date of release. This document is for informational purposes only. The user must comply with all applicable copyright laws. Without limiting the rights set forth in copyright law, no part of this article shall be reproduced, transmitted in any form or by any means (electronic, mechanical, photocopying, recording, etc.), for any purpose, in any manner or by a zhengyun and csdn.net, unless expressly permitted in writing by the author, It may not be stored or introduced into a retrieval system.