正確確實一次限制飼料數量爲25個。我已經寫了腳本來解決這個問題。在確實$ params中,您可以指定默認爲0的'開始'。
我已經創建了一個腳本,它使用作業計數創建一個foreach循環並循環API,更改'開始'以獲得不同的結果直到沒有更多的離開了。然後將它全部放入一個PHP數組中。
單一API請求,只是讓我們可以得到使用totalResults(佔總職位數)
$client = new Indeed("YOUR_ID");
$args_count = array(
"q" => "YOUR SEARCH QUERY",
"l" => "",
"co" => "GB",
"userip" => "1.2.3.4",
"limit" => 10000,
"useragent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)"
);
一旦我們有我們的25和圓形的結果了把它的總任務數。這讓我們知道我們需要多少次來運行我們的foreach
$totalResults = $client->search($args_count);
$totalCount = $totalResults['totalResults']/25;
$loop_to_count = ceil($totalCount);
我們創建一個數組從0開始,並在25秒上升到你需要儘可能多的。我的下面將返回150個結果。
$counter = 0;
$loop_options = array('0', '25', '50', '75', '100', '125', '150');
然後我們開始主要的foreach:
$results = '';
foreach ($loop_options as $options) {
$params = array(
"q" => "YOUR SEARCH QUERY",
"l" => "",
"co" => "GB",
"userip" => "1.2.3.4",
"limit" => 10000,
"start" => $options,
"useragent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)"
);
$getResults = $client->search($params);
foreach ($getResults['results'] as $rawResults) {
$Subresults[] = array(
'jobtitle' => $rawResults['jobtitle'],
'company' => $rawResults['company'],
'city' => $rawResults['city'],
'state' => $rawResults['state'],
'country' => $rawResults['country'],
'language' => $rawResults['language'],
'formattedLocation' => $rawResults['formattedLocation'],
'source' => $rawResults['source'],
'date' => $rawResults['date'],
'snippet' => $rawResults['snippet'],
'url' => $rawResults['url'],
'onmousedown' => $rawResults['onmousedown'],
'jobkey' => $rawResults['jobkey'],
'sponsored' => $rawResults['sponsored'],
'expired' => $rawResults['expired'],
'indeedApply' => $rawResults['indeedApply'],
'formattedLocationFull' => $rawResults['formattedLocationFull'],
'formattedRelativeTime' => $rawResults['formattedRelativeTime'],
'stations' => $rawResults['stations']
);
}
$counter++;
if ($counter == $loop_to_count) { break; }
}
最後所有的結果都是這個數組裏面:
$results = array ('results' => $Subresults);
$結果將包含所有已張貼在事實上作業
也許它的限制,因爲Indeed.com限制結果以25 ... – pes502
確定@ pes502,但在這種情況下如何顯示所有結果?如果確實希望網站管理員使用API,它是沒有意義的......也許他們不希望很多人使用它,因爲他們必須在點擊廣告/作業時支付網站管理員的費用。 – user3049922
當您在循環中運行腳本時,您可以繞過該限制。在此循環中,您將增加開始和結束值。 [0] =>(start:1,end:25),[1] =>(start:25,end:50)等。 – pes502