2013-05-11 5 views
0

페이지 23 페이지를 파싱하고 디렉터리 이름을 가져 오는 스크립트가 있지만 연결이 재설정되고 시간이 초과됩니다. for 루프에서이 중첩 foreachloop 때문입니까?For 루프 루프에 중첩 된 Foreach 루프

<?php 

header('Content-type: text/html; charset=utf-8'); // this just makes sure encoding is  right 
include('simple_html_dom.php'); // the parser library 

// you were trying to parse the wrong link.. your previous link did not have <div> tag with commentText class .. I chose a random link.. choose link for whichever professor you like or grab the links of professor from previous page store it in an array and loopr through them to get comments 
$i=1; 
for($i; $i < 23;$i++){ 
$html = file_get_html("http://www.ratemyprofessors.com/SelectTeacher.jsp?sid=834&pageNo=$i"); // the url for the teacher rating profile 

//your div tag has class "comment" not "commentText" 
foreach($html->find("div[class=profName]") as $content){ 
echo $content->plaintext; 
echo "<br >"; 
    } 
} 


?> 
+0

루프에 –

+5

문자열을 사용하여 set_time_limit (0)을 사용하면 23 개의 요청을 연속적으로 수신하는 것과 같은 사이트를 슬래 밍하면 IP가 누출 될 수 있습니다. –

+0

이 레코드를 검색하려면 어떻게해야합니까? – Squirtle

답변

0

내가 PHP와 함께 사용

... 당신은 그것은 꽤 빨리 YQL, 를 사용하고 검은 상장 얻기에서 당신의 IP를 방해하는 제안은 매우 간단합니다 - look here.

행운을 빈다.