Взимане на title

chovekadjo

Registered
Код:
<title>Bets-bg.com - <?php $file = file_get_contents('modules/viewobosnovani.php', $domakin, $gost);
echo "$file";
?></title>
Показва само Bets-bg.com, защо?
 
ЕМи сигурен ли си, че параметрите, които подаваш на функцията file_get_contents() са правилни.

1.filename


Name of the file to read.
2.flags

Note: Prior to PHP 6, this parameter is called use_include_path and is a bool. As of PHP 5 the FILE_USE_INCLUDE_PATH can be used to trigger include path search.

The value of flags can be any combination of the following flags (with some restrictions), joined with the binary OR (|) operator.

Available flags Flag Description
FILE_USE_INCLUDE_PATH Search for filename in the include directory. See include_path for more information.
FILE_TEXT As of PHP 6, the default encoding of the read data is UTF-8. You can specify a different encoding by creating a custom context or by changing the default using stream_default_encoding(). This flag cannot be used with FILE_BINARY.
FILE_BINARY With this flag, the file is read in binary mode. This is the default setting and cannot be used with FILE_TEXT.

3.context

A valid context resource created with stream_context_create(). If you don't need to use a custom context, you can skip this parameter by NULL.
offset

The offset where the reading starts.
4.maxlen

Maximum length of data read. The default is to read until end of file is reached.
 
Код:
function getPageTitle($response)

	{

		$pattern = '#<\s*title\s*>(.+?)<\s*/\s*title\s*>#is';

		$title = '';

		$maches = array();

		if(preg_match($pattern,$response,$maches))

		{

			$title = $maches[1];

		}

		return $title;

	}
 

Back
Горе