2009-07-01 5 views
0

내가하고 싶은 것은 변수에 url을 넣고 페이지를 실행하면 모든 입력 필드 이름을 긁어서 텍스트 파일로 내보낼 수 있다는 것입니다.PHP를 사용하여 어떻게 모든 필드 이름을 긁어 내고 텍스트 파일로 출력 할 수 있습니까?

예를 들면.

내가

<input type="text" name="firstname"> 
<input type="text" name="lastname"> 
<select name="sex"> 
<option>...</option> 
... 
</select> 

the output would be 

firstname 
lastname 
sex 

가있는 경우 뭐죠 그 일을하는 간단한 방법?

감사

+0

http://www.google.com/search?source=ig&hl=en&rlz=&=&q=site%3Astackoverflow.com+inurl%3Asarmenhb&btnG=Google+Search&aq = f & oq = 나는 그 책을 읽고 있니? 68 프로필? –

답변

3

체크 아웃 Simple HTML DOM. 그것은 당신이 그런 짓을 할 것이다 :

$html = file_get_html($my_address); 
foreach($html->find('input, select, textarea') as $input) { 
    $names[] = $input->name; 
} 
file_put_contents('my_output.txt', implode("\n", $names)); 
관련 문제