File_get_contents gets the page completely?

file_get_contents gets the page completely, but only part of the page. What could be the problem?
October 8th 19 at 01:05
5 answers
October 8th 19 at 01:07
Solution
The server returns only the first chunk is apparently crooked configured. It in text form cannot download neither curl nor wget. The browser receives a complete page because it uses gzip. To get the full page using gzip in php, to do something like this:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://nightout.ru/photoreport/alpen-grotte/after-party-zolotoi-sostav-0?page=0');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Encoding: gzip'));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo gzinflate(substr($result,10));
... "apparently the crooked configured" :-D
Cool, but still the problem is not in server but in PHP ;-) - caterina.Emard61 commented on October 8th 19 at 01:10
About php we would not have been so clear. wget and GET (the console) so the same rock stump - Maida_McGlynn71 commented on October 8th 19 at 01:13
OGROMNOE THANKS! :)

now it works! - Cristal_Considin commented on October 8th 19 at 01:16
October 8th 19 at 01:09
don't hassle with file_get_contents, use cURL to retrieve the page, I have it even works faster than file_get_contents. Switched to cURL after an error of the form PHP Warning: file_get_contents('...'): failed to open stream: Connection timed out in /var/www/...
tried instead of file_get_contents to use such a thing:

function http_request($url)
{
$curl_handler = curl_init($url);
curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl_handler);
curl_close($curl_handler);
return $response;
}

the result is the same :( - caterina.Emard61 commented on October 8th 19 at 01:12
October 8th 19 at 01:11
Used file_get_contents, fsockopen, then as noted above I switched to cURL, and even that has not solved the problem. (used to jump in the images from Facebook).
So for pages where you don't need authorization and we're only getting content rekomenduju just
<?php<br--> $l = file($url); <br> $content = implode(", $l);<br> ?><br>
did the content again circumcised on the same line... I Think the problem is in the code of the resulting page, just don't know what is - caterina.Emard61 commented on October 8th 19 at 01:14
October 8th 19 at 01:13
In the absence of details in the question.
possible :) the question said - caterina.Emard61 commented on October 8th 19 at 01:16
October 8th 19 at 01:15
1. www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen?
2. error_reporting(E_ALL); ini_set('display_errors', true) // this, on the off chance

3. Bad Protocol is not HTTP 1.1 and 1.0? Transfer-Encoding:chunked? www.php.net/manual/en/context.http.php "PHP prior to 5.3.0 does not implement chunked transfer decoding.".
The decision or find on Google (something elegant there) or via php.net/manual/en/function.fsockopen.php - caterina.Emard61 commented on October 8th 19 at 01:18
I have also wget do not download. Apparently, it's really a chunk. In any case, nefig to Rob other people's sites. - Maida_McGlynn71 commented on October 8th 19 at 01:21

Find more questions by tags ParsingPHP