Skip to content

Reoccurrence of 16023 - 403 Failure Performing file_get_contents on URL With No Restrictions #17121

@oleibman

Description

@oleibman

Description

The is a repeat of issue #16023. The solution suggested when that issue was closed worked successfully from Sept. 24 through Dec. 10. It no longer works as of Dec. 11 on github (see https://github.com/PHPOffice/PhpSpreadsheet/actions/runs/12277531354/job/34257128156?pr=4272). I have tried using TLSv1_3 as well as TLSv1_2.

I cannot reproduce the problem on a local Windows or Linux machine.

The following code:

<?php
$ctx = stream_context_create(["ssl" => ["crypto_method"=>STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT]]);
file_get_contents('https://phpspreadsheet.readthedocs.io/en/latest/topics/images/01-03-filter-icon-1.png', false, $ctx)

Resulted in this output:

Exception: file_get_contents(https://phpspreadsheet.readthedocs.io/en/latest/topics/images/01-03-filter-icon-1.png): Failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden

But I expected this output instead:

// no warning/error message

PHP Version

PHP 8.3.14, PHP 8.1.31, PHP 8.4.1

Operating System

Ubuntu 22.04.5 LTS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions