Answer the question
In order to leave comments, you need to log in
Why does it return 404 if the url is correct?
Good afternoon. You need to parse images from the site. I have a list of links and in the code I'm trying to issue a request in the form:
$value = removeBOM($value);
$str = 'http://mysite.ru/'.$value;
$sContent = file_get_contents($str);
Answer the question
In order to leave comments, you need to log in
1) var_dump ($value) should be done and make sure that the visible length matches the real one.
2) urlencode
3) punycode
file_get_contents, unlike the browser, does not encode the url, does not cut out invisible characters (at the end of $ value there may be a line break), and passes the encoding as is, which is critical for site.ru/url- Russian.
It seems to me that the encoding bits should be removed from the file and from the value variable.
In addition, it is possible in the PHP settings that it is forbidden to receive files cross-domain. Check
with Ideshka see what goes into str
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question