試したfile_get_contentsだが何らかの理由でdid'ntが私に何かを与えてくれたが、cURLはうまくいくようだ。あなたのサーバーにインストールcURLを、およびPHPのためのlibcurlの拡張子を持っている必要がありますが、あなたはこのような何かを試してみて、あなたが得るものを見ることができ
:
<?php
$cl = curl_init();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3";
$header[] = "Accept-Language: nb-NO,nb;q=0.8,no;q=0.6,nn;q=0.4,en-US;q=0.2,en;q=0.2";
$header[] = "Pragma: ";
curl_setopt($cl, CURLOPT_FAILONERROR,true);
curl_setopt($cl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7');
curl_setopt($cl, CURLOPT_HTTPHEADER, $header);
curl_setopt($cl, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($cl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($cl, CURLOPT_AUTOREFERER, false);
curl_setopt($cl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cl, CURLOPT_CONNECTTIMEOUT, 2);
$url = 'http://pinterest.com/source/google.com/';
curl_setopt($cl, CURLOPT_URL, $url);
$output = curl_exec($cl);
curl_close($cl);
?>
<!DOCTYPE html>
<head>
<title>get pinterest</title>
</head>
<body>
<xmp>
<?php echo $output; ?>
</xmp>
</body>
</html>
この場合には、それができなくなりますセッション全体をシミュレートして、Cookieやすべてを追跡する必要があります。 – miki
それは難しいことではありません。最初のリクエストで取得したクッキーを保存し、それ以降のリクエストで送信します。サーバーがそれを望んでいるかもしれませんが、ヘッダーはリクエストの前に追加して 'ブラウザのように'することができます – SuperSaiyan