php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46775 file_get_contents via HTTPS wrapper produces corrupt response from eBay API
Submitted: 2008-12-06 04:37 UTC Modified: 2008-12-12 09:27 UTC
From: php1 at nmpu dot com Assigned:
Status: Not a bug Package: OpenSSL related
PHP Version: 5.2CVS-2008-12-06 (snap) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php1 at nmpu dot com
New email:
PHP Version: OS:

 

 [2008-12-06 04:37 UTC] php1 at nmpu dot com
Description:
------------
I use file_get_contents with the HTTPS wrapper to post a request to an eBay API server and retrieve the response. Recently, I noticed a response with what appears to be leading and trailing garbage. A similar solution based on cURL produces the expected response (no garbage). The issue was originally discovered on a Linux/Apache box. I downloaded the latest WIN32 PHP/Apache and can still reproduce.

Reproduce code:
---------------
http://exdwh.com/ebay/bugs/https_wrapper_bug.txt

Contact me if you don't have easy access to the necessary eBay authorization tokens. You could sign up at http://developer.ebay.com quicker than sending me an e-mail and waiting for the response. :)

Expected result:
----------------
cURL says |<?xml version='1.0' encoding='UTF-8'?><getJobsResponse xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services"><ack>Success</ack><version>1.0.0</version><timestamp>2008-12-06T03:26:32.487Z</timestamp></getJobsResponse>|

Actual result:
--------------
http wrapper says |10d <?xml version='1.0' encoding='UTF-8'?><getJobsResponse xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services"><ack>Success</ack><version>1.0.0</version><timestamp>2008-12-06T03:26:32.278Z</timestamp></getJobsResponse> 0 |

Leading garbage is: 31 30 64 0D 0A

Trailing garbage is: 0D 0A 30 0D 0A 0D 0A


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-12 09:27 UTC] bjori@php.net
You are getting HTTP/1.1 chunked content back.
The PHP streams do not support it.

This actually seems like a bug in the eBay servers to me as (unless you explicitly set it) we send out HTTP/1.0 requests.

Make sure you dont have a default context setting the protocol_version option, or report it to eBay :)
(for more info about the context options see: http://php.net/context)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 02:01:36 2025 UTC