function
get_contents(
$url
,&
$cookie
) {
$ch
= curl_init();
curl_setopt(
$ch
, CURLOPT_URL,
$url
);
curl_setopt(
$ch
, CURLOPT_COOKIE,
$cookie
);
curl_setopt(
$ch
, CURLOPT_RETURNTRANSFER, true);
curl_setopt(
$ch
, CURLOPT_FOLLOWLOCATION, true);
curl_setopt(
$ch
, CURLOPT_MAXREDIRS, 5);
curl_setopt(
$ch
, CURLOPT_AUTOREFERER, true);
curl_setopt(
$ch
, CURLOPT_HEADER, 1);
curl_setopt(
$ch
, CURLOPT_TIMEOUT, 5);
//cookie
preg_match_all(
'|Set-Cookie: (.*);|U'
,
$file_contents
,
$results
);
$cookies
= implode(
';'
,
$results
[1]);
curl_close(
$ch
);
return
$file_contents
;
}