Optional parameter for parseurl to only fetch data from meta information

This commit is contained in:
Michael Vogel 2013-12-02 20:24:41 +01:00
commit 4f38969148
2 changed files with 31 additions and 32 deletions

View file

@ -50,7 +50,7 @@ function completeurl($url, $scheme) {
return($complete);
}
function parseurl_getsiteinfo($url) {
function parseurl_getsiteinfo($url, $no_guessing = false) {
$siteinfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@ -184,7 +184,7 @@ function parseurl_getsiteinfo($url) {
}
}
if (@$siteinfo["image"] == "") {
if ((@$siteinfo["image"] == "") AND !$no_guessing) {
$list = $xpath->query("//img[@src]");
foreach ($list as $node) {
$attr = array();
@ -223,7 +223,7 @@ function parseurl_getsiteinfo($url) {
"height"=>$photodata[1]);
}
if (@$siteinfo["text"] == "") {
if ((@$siteinfo["text"] == "") AND (@$siteinfo["title"] != "") AND !$no_guessing) {
$text = "";
$list = $xpath->query("//div[@class='article']");