The GET command gives two kinds of output, why?
iam using the GET command to get the page content. When I write the same command at a shell prompt, it gives the correct result, but when I use that in a PHP file, it sometimes gives the correct result, but sometimes it only gives half the content, that is, only a part and a half.
Iam using the following command in a shell script: -
GET http://www.abc.com/ -H "Referer:http://www.abcd.com/"
and following in PHP file: -
$data=exec('GET http://www.abc.com/ -H "Referer:http://www.abcd.com/"');
echo $data;
Now tell me why this command doesn't give the full content of the page when I use it in a php file.
+2
a source to share
3 answers
Alternative with pure php:
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Referer: http://www.abc.com/\r\n"
)
);
$context = stream_context_create($opts);
$file = file_get_contents('http://www.abc.com/', false, $context);
0
a source to share