external links
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support
external links
It is due to now using this DOMXPath instead of curl due to nubs posting a gazillion links in one post.
external links
http://www.thostrupvejens-traepillesalg.dk/
So at the end of the day there is no 100% good solutions as long as there are sites that is bad coded?
Code: Select all
<title>Træpiller, Træpillesalg, Miljøvenlig træpiller og Briketter i Midtjylland, Århus, Silkeborg, Hadsten, Hinnerup, Viborg, Kjellerup, Østjylland,Randers,kjellerup,pillebrændeovn,pilleovn, - www.thostrupvejens-traepillesalg.dk</title>
external links
Try this for the function
Code: Select all
/**
* A subroutine of make_clickable to retrieve
* titles of links posted
*
*/
function make_title_link ($url, $text)
{
$handle = @file_get_contents($url);
$handle = mb_convert_encoding($handle, 'HTML-ENTITIES', "UTF-8");
$dom = new DOMDocument();
if (@$dom->loadHTML($handle))
{
$xpath = new DOMXPath($dom);
if (!empty($xpath->query('//title')->item(0)->nodeValue))
{
$title = $xpath->query('//title')->item(0)->nodeValue;
$text = str_replace("\n", " ",$title);
return $text;
}
}
return $text;
}
external links
..and yes, there is no code that I know of that can handle every permutation of every poorly coded site.
external links
I'm still using the code in the first post and have no problems with it so far it's doing what it's ment too
http/https and stokers funky link in this topic but as you pointed out rich it wont do phpbb.com links.
And now you have posted another code i just have to try it
And on that note i'm using xampp 1.7.4 (i think it is) but my xampp is no longer standard thanx to Jon from there forums.
http/https and stokers funky link in this topic but as you pointed out rich it wont do phpbb.com links.
And now you have posted another code i just have to try it

And on that note i'm using xampp 1.7.4 (i think it is) but my xampp is no longer standard thanx to Jon from there forums.
external links
This is my very, very last try. I have tried to take all of Stokers funky pages into effect as well as https stuffs and stuffs for those nubs that put in bs links that go nowhere. Here ya go.
If someone posts another link saying this doesn't work on that link, to damn bad...fix it. 
Code: Select all
/**
* A subroutine of make_clickable to retrieve
* titles of links posted
*
*/
function make_title_link($url, $text)
{
$handle = @file_get_contents($url);
if(!empty($handle))
{
preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $handle, $matches );
if(isset($matches[3]))
{
$handle = $handle;
}
else
{
$handle = mb_convert_encoding($handle, 'HTML-ENTITIES', "UTF-8");
}
$dom = new DOMDocument();
if (@$dom->loadHTML($handle))
{
$xpath = new DOMXPath($dom);
if (!empty($xpath->query('//title')->item(0)->nodeValue))
{
$title = $xpath->query('//title')->item(0)->nodeValue;
$text = str_replace("\n", " ",$title);
return $text;
}
}
}
return $text;
}

external links
RMcGirr83 wrote:This is my very, very last try. I have tried to take all of Stokers funky pages into effect as well as https stuffs and stuffs for those nubs that put in bs links that go nowhere. Here ya go.
If someone posts another link saying this doesn't work on that link, to damn bad...fix it.Code: Select all
/** * A subroutine of make_clickable to retrieve * titles of links posted * */ function make_title_link($url, $text) { $handle = @file_get_contents($url); if(!empty($handle)) { preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $handle, $matches ); if(isset($matches[3])) { $handle = $handle; } else { $handle = mb_convert_encoding($handle, 'HTML-ENTITIES', "UTF-8"); } $dom = new DOMDocument(); if (@$dom->loadHTML($handle)) { $xpath = new DOMXPath($dom); if (!empty($xpath->query('//title')->item(0)->nodeValue)) { $title = $xpath->query('//title')->item(0)->nodeValue; $text = str_replace("\n", " ",$title); return $text; } } } return $text; }
Rich I just wanted to let you know that with that code quoted I still get this error when a lot of links are posted:
Code: Select all
Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to allocate 53656360 bytes) in /forum/public_html/includes/functions_content.php on line 523