ページから特定の行を取得するように求められましたが、サイトがCURLリクエストをブロックしているようです。
問題のサイトはhttp://www.habbo.com/home/Intricatです。
UserAgentを変更して、それをブロックしているかどうかを確認しようとしましたが、うまくいかなかったようです。
私が使用しているコードは次のとおりです。
<?php
$curl_handle=curl_init();
//This is the URL you would like the content grabbed from
curl_setopt($curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0");
curl_setopt($curl_handle,CURLOPT_URL,'http://www.habbo.com/home/Intricat');
//This is the amount of time in seconds until it times out, this is useful if the server you are requesting data from is down. This way you can offer a "sorry page"
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
//This Keeps everything running smoothly
curl_close($curl_handle);
// Change the message bellow as you wish, please keep in mind you must have your message within the " " Quotes.
if (empty($buffer))
{
print "Sorry, It seems our weather resources are currently unavailable, please check back later.";
}
else
{
print $buffer;
}
?>
CURLリクエストをブロックした場合に、そのページからコード行を取得できる別の方法に関するアイデアはありますか?
編集:サーバーでcurl -iを実行すると、サイトが最初にCookieを設定しているように見えますか?