I'm using the example of this post How to get content from another page but I need to get just "SUPERMAN" from website with this format:
<td headers="superHero">SUPERMAN</td>
<td headers="country">USA</td>
the code:
$url = "http://www.otherweb.com";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($curl);
curl_close($curl);
$DOM = new DOMDocument;
$DOM->loadHTML( $output);
//get all td
//$items = $DOM->getElementsByTagName('td');
$items = $DOM->getElementsByID('superHero');
//display all text
for ($i = 0; $i < $items->length; $i++)
echo $items->item($i)->nodeValue . "<br/>";
Thanks!!!