R
R
Ramiro Disango2018-02-14 15:21:52
PHP
Ramiro Disango, 2018-02-14 15:21:52

File_get_contents not opening image?

Hey!
Such a thing.
I make a request, I want to upload an image.

file_get_contents('http://sites.vu/images/110973.jpg');

And he gives me a fig!
Warning: file_get_contents(http://sites.vu/images/110973.jpg): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/engine.sites.vu/public/engine/moduls/sites/go_pleas.php on line 9

Through the browser of course 200, the picture loads.
I understand the problem is that the server rejects requests not from the browser.
I can't use curl.
What should I write on the server so that it does not send my request to ...?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kuznetsov, 2018-02-14
@dima9595

Read the documentation: php.net/manual/ru/function.file-get-contents.php

D
Dmitry Gadzhiev, 2018-02-15
@gds1

somehow I can’t understand what it is to upload and file_get_contents. what is the relationship? file_get_contents - read into a string from some resource. please give more complete code to make it clear why it doesn't work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question