|  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
 [2008-12-06 04:37 UTC] php1 at nmpu dot com
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:

Contact me if you don't have easy access to the necessary eBay authorization tokens. You could sign up at 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="" xmlns=""><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="" xmlns=""><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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-12 09:27 UTC]
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:

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Dec 06 18:05:53 2022 UTC