external links

Modifications for phpBB3.
Try the Mods here and share Your own Mods
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

external links

Post by neuropass »

lol RICH ( damn so hard to get names right when your are not English mother tongue!) Thanks again for your help. It is very much appreciated.

external links

Post by Stoker »

Yeah, thanks Dick for sharing :)

external links

Post by Stoker »

RMcGirr83 wrote:Try this instead

Code: Select all

             $curl = curl_init();
             curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($curl, CURLOPT_URL, $url);
			 curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
             $result = curl_exec($curl);
             curl_close($curl);         
             if(!empty($result))
             {
                $dom = new DOMDocument();
                if (@$dom->loadHTML($result))
                {
                   $title = $dom->getElementsByTagName('title');
                   if (!empty($title->item(0)->nodeValue))
                   {
                      $text = str_replace("\n", " ", $title->item(0)->nodeValue);
                      break;
                   }
                }
             }
And if we want to support non english characters like æøå?

external links

Post by RMcGirr83 »

You can start by supplying a link that has those funky characters.

external links

Post by Stoker »

external links

Post by RMcGirr83 »

New Code

Code: Select all

	$curl = curl_init();
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 5);
	$result = curl_exec($curl);
	curl_close($curl);         
	if(!empty($result))
	{
		$dom = new DOMDocument();
		$result = mb_convert_encoding($result, 'HTML-ENTITIES', "UTF-8");
		if (@$dom->loadHTML($result))
		{
			$title = $dom->getElementsByTagName('title');
			if (!empty($title->item(0)->nodeValue))
			{
			  $text = str_replace("\n", " ", $title->item(0)->nodeValue);
			  break;
			}
		}
	}
Last edited by RMcGirr83 on 24 Apr 2013, 10:03, edited 1 time in total.

external links

Post by martin123456 »

RMcGirr83 wrote:New Code

Code: Select all

	$curl = curl_init();
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
	$result = curl_exec($curl);
	curl_close($curl);         
	if(!empty($result))
	{
		$dom = new DOMDocument();
		$result = mb_convert_encoding($result, 'HTML-ENTITIES', "UTF-8");
		if (@$dom->loadHTML($result))
		{
			$title = $dom->getElementsByTagName('title');
			if (!empty($title->item(0)->nodeValue))
			{
			  $text = str_replace("\n", " ", $title->item(0)->nodeValue);
			  break;
			}
		}
	}
Works good but gives errors in the acp
line code curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
logs.png
You do not have the required permissions to view the files attached to this post.

external links

Post by Stoker »

change ch with curl

external links

Post by RMcGirr83 »

Whoops! :oops:

external links

Post by Stoker »

Thanks for the code Rick :thumb: