0

スクリプトを作っています。そして、このスクリプトでは、いくつかのキーワードリストを提供します。そして、それはターゲットサイトに行き、データを取得します。私のコードを見てください:

//my option start
$toplist=file_get_contents('http://mysite/list.txt');

//list grabbing

$listgrabbing=explode('target="_',$toplist);
$counting=count($listgrabbing);
$l='0';
for ($l=0 ; $l <=$counting ; $l++){
$targetsite='http://targetsite/search?q='.$listgrabbing;
$revip=file_get_contents($targetsite);

//Rest of code

ほら、txtファイルにいくつかのキーワードリストがあります。。そのような :

football
cricket
basketball
chase 

私のコードは最初のキーワードを取り、ターゲットサイトを検索して取得します。そして、2番目、3番目、4番目...しかし、それはリストからキーワードを選択することではありません。ここでのエラーは何ですか?

4

1 に答える 1

1
$toplist=file_get_contents('http://mysite/list.txt');
$listgrabbing=explode("\n",$toplist);
foreach($listgrabbing as $item){
     $targetsite='http://targetsite/search?q='.$item;
     $revip=file_get_contents($targetsite);
}
于 2012-10-29T17:50:42.730 に答える