File_get_contents timeout from a responsive page

I’m trying to puzzle out why file_get_contents is failing to open a URL, when the same computer gets a near-instant response from the same URL through a browser.

Any thoughts as to what might be the cause?

openssl is enabled,
allow_fopen_url is On,
i’ve tried ini_set’ing a user_agent,
i’ve tried forming a stream context

Does the server have all intermediate certificates installed for their TLS certificate? A lot of sites only install their own cert and the root cert, but not intermediates. Browsers are fine with this, but cURL for example is not. Maybe PHP streams aren’t either?

1 Like

The ‘server’ is an application’s web interface. I’d be surprised that they actually had their own certificate installed.

I… suppose i could wireshark the connection and sniff for TLS handshaking…

So what i see in wireshark is a SYN, followed by a SYN,ACK, and then 2 retransmissions of those signals (i’ve set the timeout on fopen to 5 seconds, so it doesnt get any further than that.)

Odd, because it doesnt even try to establish the TLS handshake…

grumbles

Does adding a callback function to the stream context give any useful info? See first example here: https://www.php.net/manual/en/function.stream-notification-callback.php#refsect1-function.stream-notification-callback-examples

The stream never gets any data, so a callback never gets proc’d :confused:

Right, in that case I’m officially out of ideas :man_shrugging:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.