<?php
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
include('inc/simple_html_dom.php');
//base url
$base = 'https://play.google.com/store/apps';
//home page HTML
$html_base = file_get_html( $base );
//get all category links
foreach($html_base->find('a') as $element) {
echo "<pre>";
print_r( $element->href );
echo "</pre>";
}
$html_base->clear();
unset($html_base);
?>
I have the above code and I'm trying to get certain elements of the Play Store page but it isn't returning anything. Is it possible that certain PHP functions might be disabled on the server to stop that?
The above code works perfectly on other sites.
Is there any workaround?
As I said, your example is working fine for me... But try this way using curl instead:
It gets all the links as expected:
And make sure you have
php_openssl
andphp_curl
installed...DOMDocument::loadHTML() [domdocument.loadhtml]: htmlParseStartTag: misplaced THIS IS URL : http://www.annauniv.edu/cgi-bin/result/cgrade.pl?regno=11210104001
remove the semicolon from php.ini and restart Apache server to enable php module configuration
You must set "allow_url_fopen" as TRUE in "php.ini" to allow accessing files via HTTP or FTP.
Some hosting venders disable PHP's "allow_url_fopen" flag for security issues.