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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 01 21:05:53 2022 UTC