私は単純なhtml domまたはその他の擦れ質問を持っています。ファイルを解析することさえできます。知りません。私はここにいない運でいくつかの異なる方法を試してみましたSimpleHTMLDomを使用してWebサイトから画像を取得する
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 DOMを使用しています...三振しています。上のコードは http://davidwalsh.name/php-notificationsから直接です。私が間違っていることはわかりません。私はHRタグのような小さなものをもう一度入手しますが、Danger Roseは.feedEntryContent->table->tbody->tr->td
にあります。.feedEntryContent->table->tbody->tr->td
これらを両方とも$変数に入れて、別のレイアウトで使用できるようにしたいと思います。
ありがとうございました。
編集:これはDanger Roseを得ました。 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>';
}
?>
を使用して、それを解析お勧めします私はRegExを使いたくない。ありがとう。 – jasonflaherty