Smtp.php
-
- Utilizator înregistrat
- Mesaje: 139
- Membru din: 17-Mar-2007, 09:41:22
- Ext: Nu
- Server: Windows
- Nivel phpBB: Mediu
- Nivel php: Mediu
- Localitate: Brasov / Cork (Irlanda)
- Contact:
Din cate stiu, xhost nu permite trimiterea mesajelor prin smtp, s-ar putea sa ma insel. Ca sa te convingi, salveaza intr-un fisier cu numele test.php urmatorul cod. Apoi incarca-l in radacina contului tau de gazduire si acceseaza-l din browser. Daca la testul fsockopen vei obtine un mesaj de eroare sau un warning, inseamna ca functia nu e activa, deci trimiterea mesajelor nu are cum sa iti mearga.
Cod: Selectaţi tot
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-gb" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Function Test</title>
</head>
<body>
PHP mail() and fsockopen function test.
<p >
Send Mail check follows.. no error indicates it's working.</p>
<?php
// The message
$message = "Line 1\nLine 2\nLine 3";
// Send
mail('mailcheck@somecrappyfakedomainname.whatver.com', 'test subject', $message);
?>
<p>
FSOCKOPEN test follows: </p>
<p>
<b>
<?
echo get_url_title("http://news.bbc.co.uk");
function get_url_title($url, $timeout = 2)
{
$url = parse_url($url);
if(!in_array($url['scheme'],array('','http')))
return;
$fp = fsockopen ($url['host'], ($url['port'] > 0 ? $url['port'] : 80), $errno, $errstr, $timeout);
if (!$fp)
{
return;
// echo "$errstr ($errno)<br>\n";
}
else
{
fputs ($fp, "GET /".$url['path'].($url['query'] ? '?'.$url['query'] : '')." HTTP/1.0\r\nHost: ".$url['host']."\r\n\r\n");
$d = '';
while (!feof($fp))
{
$d .= fgets ($fp,2048);
if(preg_match('~(</head>|<body>|(<title>\s*(.*?)\s*</title>))~i', $d, $m))
break;
}
fclose ($fp);
return $m[3];
}
}
?>
</b>
</p>
<p></p>
<p></p>
FSOCKOPEN test ends. </p>
<p></p>
<p>PHP Info Follows:</p>
<p></p>
<p ><? phpinfo(); ?></p>
</body>
</html>
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 1 vizitator