Alex N
Alex N

Reputation: 1121

How get content in block which we get from remote url (parsing)?

Good day.

i use code:

$file = file_get_contents('http://www.whois.com/whois/testtest.com');

Full code page whice get $file you can see here

Tell me please how get content in block <div class="whois_result" id="registryData">....</div> ?

Upvotes: 0

Views: 244

Answers (1)

Bad Wolf
Bad Wolf

Reputation: 8349

Regardless of you you scrape the remote page (hint: look at cURL), you need some sort of DOM parser to parse the response.

libxml_use_internal_errors(true); //Prevents Warnings, remove if desired
$dom = new DOMDocument();
$dom->loadHTML($file);
$node = $dom->getElementById("registryData");
$output = $dom->saveHTML($node);

echo $output;

Upvotes: 2

Related Questions