Reputation: 471
i don't know if my title is correct feel free to correct me, but i have a simple issue. My code is working fine and i am getting the results that i want, but i want them in an array. For example:[0] => Description: Sentinel. Winged Guardian cannot have restricted attachments. Forced: After an attack in which Winged Guardian defends resolves, pay 1 Tactics resource or discard Winged Guardian from play.
[1] => Description: Attach to a hero. Attached hero gains +1 Attack. Action: Pay 1 resource from attached hero's pool to attach Dunedain Mark to another hero.
This is my code:
include 'simple_html_dom.php';
$url="http://hallofbeorn.com/LotR?CardSet=The+Hunt+for+Gollum";
$html=file_get_html($url);
foreach ($html->find('div[style="margin-left:2px;vertical-align:top;text-align:left;"]') as $values) {
echo $values->plaintext;
}
Upvotes: 3
Views: 366
Reputation: 462
I guess this is what you are looking for:
include 'simple_html_dom.php';
$url="http://hallofbeorn.com/LotR?CardSet=The+Hunt+for+Gollum";
$html=file_get_html($url);
$html_arr = [];
foreach ($html->find('div[style="margin-left:2px;vertical-align:top;text-align:left;"]') as $values) {
$html_arr[] = $values->plaintext;
}
print_r($html_arr);
Upvotes: 2