S
S
Snewer2016-12-23 20:56:32
PHP
Snewer, 2016-12-23 20:56:32

Why is the get request executed correctly in the browser, but not from php?

Hello!
There is some URL that javascript on the site sends GET requests to. I want to execute the same request from php and get the same response as in the browser. But problems arise: the request either takes a long time to load or breaks altogether. A different response size (in bytes) is also returned. If you do the same from the console on the site (jQuery.get('...')), then the request is sent and the desired result is returned. With what it can be connected? How can I simulate a browser request to the server in php? Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2016-12-23
@reaferon

I suspect that this URL is not accessible from the server. Try ssh in and ping the host. And look at the trace.

T
ThunderCat, 2016-12-23
@ThunderCat

Where is the server? on the same domain? Cookies, authorization, other nuances... It's not clear from the question
the code of two lines

$some = file_get_contents('https://www.numismat.ru/bgimauctabs/43792a.zif');
var_dump($some);

I dump the same thing in the browser as when downloading the file directly by the browser, which means either your server is naughty, or you have some kind of crap with access to the site from the server where the script is being executed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question