Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The server gives only the first chunk, apparently it is crookedly configured. Neither curl nor wget can download it in text form. The browser gets the full page because it uses gzip. To get a full page via gzip in php, you need 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));
do not suffer with file_get_contents, use cURL to get the page, for me it even works faster than file_get_contents. Switched to cURL after errors like PHP Warning: file_get_contents('...'): failed to open stream: Connection timed out in /var/www/…
I used file_get_contents, fsockopen, then, as noted above, I switched to cURL, and even this did not solve the problem. (used on the jump of images from VKontakte).
Therefore, for pages where authorization is not needed, but you only need to receive content, I recommend simply
<?php
$l = file($url);
$content = implode('', $l);
?>
1. www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen ?
2. error_reporting(E_ALL); ini_set('display_errors', true) // this is so, maybe
3. Bad protocol is not HTTP 1.1 but 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.".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question