나는 간단한 html dom 또는 다른 긁는 질문이 있습니다. 심지어 파일을 파싱 할 수도 있습니다. 나는 모른다. 내가 여기에 행운과 함께 몇 가지 방법을 시도SimpleHTMLDom을 사용하여 웹 사이트에서 이미지 가져 오기
http://www.sierraavalanchecenter.org/bottomline-rss.php
// Include the library
include('simple_html_dom.php');
$html = file_get_html('http://www.sierraavalanchecenter.org/bottomline-rss.php');
// Retrieve all images and print their SRCs
foreach($html->find('img') as $e)
echo $e->src . '<br>';
// Find all images, print their text with the "<>" included
foreach($html->find('img') as $e)
echo $e->outertext . '<br>';
// Find the DIV tag with an id of "myId"
foreach($html->find('div#dangericon') as $e)
echo $e->innertext . '<br>';
: 나는
내가 시도하고이 피드에서 이미지를 얻기 위해 간단한 HTML 돔을 사용하고 ... 삼진 아웃입니다 . 위 코드는 http://davidwalsh.name/php-notifications입니다.내가 잘못하고있는 것이 확실하지 않습니다. HR 태그와 같은 몇 가지 작은 물건을 얻을 수는 있지만 위험 장미는 아닙니다 .feedEntryContent->table->tbody->tr->td
이 두 가지를 모두 $ 변수에 넣어서 다른 레이아웃에서 사용할 수 있습니다.
아무쪼록 고맙습니다.
편집 : 이것은 위험 로즈입니다. bottom-line.php 파일에 뭔가있을 수 있습니다 ...?
<?php
// Include the library
include('simple_html_dom.php');
$html = file_get_html('http://www.sierraavalanchecenter.org/advisory');
foreach($html->find('td.views-field-field-danger-rose-php-value img') as $e){
echo '<img src="http://www.sierraavalanchecenter.org/'. $e->src . '" width="400px" height="180px"/><br>';
}
?>
simplexml_load_file 사용하여 구문 분석을 권 해드립니다 RegEx를 사용하고 싶지 않습니다. 감사. – jasonflaherty