|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-09 16:25 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 00:00:01 2025 UTC |
Description: ------------ This function works fine with with PHP-4.3.1 but since recently upgrading to 4.3.6 and/or 4.3.7 it strips out the headers as appopriate but returns an empty body. (I've cut out the host code and the cookie code for obvious security issues.) What's weird is if I do not strip out the headers they list the correct Content-Length for the body, but the body is empty. At first I thought it might be the cURL library so I downgraded from cURL-7.11.1 to cURL-7.10.3, but that did not resolve the issue. It will only work with PHP-4.3.1 which seems rather odd. Any thoughts are greatly appreciated in resolving this issue. ############## ./configure --with apxs=/usr/local/apache/bin/apxs --enable-bcmath --with-curl --with-mysql=/usr/local/mysql --with-mcrypt=/usr/local/lib --with-openssl=/usr/local/ssl --without-pear --disable-cgi --with-gd --with-zlib --with-jpeg-dir=/usr/local/lib --with-pfpro --enable-xml Reproduce code: --------------- function send_to_factual_data($post_data) { // Open an SSL connection to the server $fp = fsockopen("ssl://priate.ssl.host", 443, $errno, $errstr); // Make sure we're connected if (!$fp) return "Error Connecting To FactualData.com - $errstr ($errno)"; else { // Send the HTTP headers fputs($fp, "POST /applet/path/here HTTP/1.0\r\n" . "User-Agent: Mozilla/4.00\r\n" . "Content-Type: text/xml\r\n" . "Content-Length: " . strlen($post_data) . "\r\n" . "Cookie: CERT=*CENSORED*;\r\n\r\n"); // Send the POST data fputs($fp, $post_data); // Read the response - limit of 1M bytes should be OK $xml = @ fread($fp, 1000000); // Length of server response including headers $len = strlen($xml); // Strip the headers $xml = strstr($xml, "\r\n\r\n"); // Skip the 2 CRLFs if we removed the headers if ($len != strlen($xml)) $xml = substr($xml, 4); return $xml; } } // end of function: send_to_factual_data Expected result: ---------------- When I run the code I expect to have an XML credit report file returned to me. I expect the code to strip off the HTML headers and leave the body intact for me to parse with my XML parsing scripts. Instead what happens is I get back the HTML headers that say they have content, but there is no content to be found. Actual result: -------------- HTTP/1.1 200 OK Content-Type: text/xml Content-Length: 57717 Connection: close Date: Mon, 07 Jun 2004 18:51:24 GMT Server: Apache Tomcat/4.1.27-LE-jdk14 (HTTP/1.1 Connector) ### The Content-Type and Content-Length are correct, but there is no data to be found, just the headers. Thank you for your time!