Bug #40197 [Com]: Cannot access remote files
| From: | hoossam-1987 at hotmail dot com | Date: | Fri, 02 Mar 2018 12:46:20 +0000 |
| Subject: | Bug #40197 [Com]: Cannot access remote files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214178@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=40197&edit=1
ID: 40197
Comment by: hoossam-1987 at hotmail dot com
Reported by: ddrewery at gmail dot com
Summary: Cannot access remote files
Status: Not a bug
Type: Bug
Package: HTTP related
Operating System: Fedora Core 6
PHP Version: 5.2.0
Assigned To: tony2001
Block user comment: N
Private report: N
New Comment:
I AM facing the below issue , only with .pdf https links ,and i am searching from long time , but
still i didnt find any solution .
Can i have some one help regarding this case .
Error:
failed to open stream: HTTP request failed!
Source Code :
$download_link = 'https://www.aramex.com/docs/default-source/resourses/resourcesdata/shipping-services-api-manual.pdf';
// Download File Content
$file_data = file_get_contents($download_link,1,NULL);
// Create File
$handle = fopen($file_name, 'w');
fclose($handle);
// Save Content to file
$downloaded = file_put_contents($file_name, $file_data);
if($downloaded > 0)
{
echo 'file was successfully downloaded! <br>' ;
}
Previous Comments:
------------------------------------------------------------------------
[2016-12-02 11:11:32] requinix@php.net
@spargo32: This is a bug reporting system, not a support forum. http://www.php.net/support.php But I will say that
Windows' cmd.exe does not support quoting arguments with apostrophes.
------------------------------------------------------------------------
[2016-12-02 09:25:35] spargo32 at gmail dot com
I've got the error when I use this
```
D:\Folder>php -r 'file_get_contents("http://packagist.org/p/symfony/var-dumper%24ea3512377b773427554949beddf0ed0f9a6c6f43ba6069419cde361083f78a3c.json");'
Parse error: syntax error, unexpected end of file in Command line code on line 1
```
And everything is well if I replace quotes
```
D:\Folder>php -r "file_get_contents('http://packagist.org/p/symfony/var-dumper%24ea3512377b773427554949beddf0ed0f9a6c6f43ba6069419cde361083f78a3c.json');"
```
What is the problem?
------------------------------------------------------------------------
[2007-01-25 15:03:46] tony2001@php.net
>She had me uncheck a box in the internal settings of the
>firewall labled "Enforce Host Tag Search with for CFS"
>and suddently everything works.
So this is the answer to the question why fsockopen() worked.
As I said, PHP uses HTTP/1.0 for http streams by default and "Host: " header is required
only by HTTP/1.1.
------------------------------------------------------------------------
[2007-01-25 14:54:59] ddrewery at gmail dot com
Ok, I finally go ahold of sonic wall tech support and they have resolved the issue. Maybe you can
help me understand what this means.
She had me uncheck a box in the internal settings of the firewall labled "Enforce Host Tag
Search with for CFS" and suddently everything works. She rambled off something about header
packet size being limited to 32.. but lost me from there.
With that information, can you tell me what fsocketopen and fopen would be sending differently to
change the header response?
------------------------------------------------------------------------
[2007-01-23 18:13:18] tony2001@php.net
Use a sniffer. tcpdump, for example.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=40197
--
Edit this bug report at https://bugs.php.net/bug.php?id=40197&edit=1