php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39745 can't get partial contents with streams
Submitted: 2006-12-05 17:06 UTC Modified: 2006-12-05 18:45 UTC
From: siegfri3d at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.0 OS: Linux debian sid, windows xp sp2
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: siegfri3d at gmail dot com
New email:
PHP Version: OS:

 

 [2006-12-05 17:06 UTC] siegfri3d at gmail dot com
Description:
------------
see bug http://bugs.php.net/bug.php?id=36857
The man answered but you never replied.
He also posted an example on http://it2.php.net/file_get_contents on how to get a partial content with file_get_contents, it was working according to him, now it doesn't work anymore. For me it returns the whole content, maybe the syntax is wrong? If so it would be nice to correct it on the php.net page

Reproduce code:
---------------
<?php
$context=array('http' => array ('header'=> 'Range: bytes=1-20', ),);
$xcontext = stream_context_create($context);
$str=file_get_contents("http://www.google.it",FALSE,$xcontext);
echo $str;
?>

Expected result:
----------------
that it returns the 20 first bytes of www.google.it.

Actual result:
--------------
It returns the whole page

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-05 18:45 UTC] tony2001@php.net
Well, www.google.it just doesn't support it.
You can verify it with www.example.com, which understands Range header just fine.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC