Тема: fsockopen()+proxy
Показать сообщение отдельно

  #6  
Старый 15.12.2008, 21:29
Pashkela
Динозавр
Регистрация: 10.01.2008
Сообщений: 2,841
Провел на форуме:
9220514

Репутация: 3338


По умолчанию

http://ru2.php.net/fsockopen

CTRL+F "prox"

вроде там всё есть. Задачу ты конкретизировал конкретно А вот пример работы с pop3

PHP код:
The following function performs pop3 authentication. Returns NULL on error, or true/false to indicate username/password matching:

$address is the hostname of the server and $ssl is a boolean that indicates whether an SSL connection is requested.

<?php
function pop3authCheck($username$password$address$ssl)
{
    if (
$ssl)
        
$uri="ssl://$address:995";
    else
        
$uri="tcp://$address:110";

    
$fp=fsockopen($uri);

    if (!
$fp)
        return(
NULL);

    
$st=fgets($fp512);
    if (
substr($st03)!="+OK")
    {
        
fclose($fp);
        return(
NULL);
    }

    
$st="USER $username\n";
    if (
fwrite($fp$st)!=strlen($st))
    {
        
fclose($fp);
        return(
NULL);
    }

    
$st=fgets($fp512);
    if (
substr($st03)!="+OK")
    {
        
fclose($fp);
        return(
NULL);
    }

    
$st="PASS $password\n";
    if (
fwrite($fp$st)!=strlen($st))
    {
        
fclose($fp);
        return(
NULL);
    }

    
$st=fgets($fp512);
    
fclose($fp);
    if (
substr($st03)=="+OK")
        return(
true);
    else if (
substr($st04)=="+ERR")
        return(
false);
    else
        return(
NULL);
}
?>

Последний раз редактировалось Pashkela; 15.12.2008 в 21:33..
 
Ответить с цитированием