本文整理汇总了PHP中SimpleSocket::getSent方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSocket::getSent方法的具体用法?PHP SimpleSocket::getSent怎么用?PHP SimpleSocket::getSent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSocket
的用法示例。
在下文中一共展示了SimpleSocket::getSent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRecordOfSentCharacters
public function testRecordOfSentCharacters()
{
$socket = new SimpleSocket('www.lastcraft.com', 80, 15);
$this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: www.lastcraft.com\r\n");
$socket->write("Connection: close\r\n\r\n");
$socket->close();
$this->assertEqual($socket->getSent(), "GET /test/network_confirm.php HTTP/1.0\r\n" . "Host: www.lastcraft.com\r\n" . "Connection: close\r\n\r\n");
}
示例2: testRecordOfSentCharacters
public function testRecordOfSentCharacters()
{
$socket = new SimpleSocket($this->host, $this->port, 15);
$this->assertTrue($socket->write("GET /network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: {$this->host}\r\n");
$socket->write("Connection: close\r\n\r\n");
$socket->close();
$this->assertEqual($socket->getSent(), "GET /network_confirm.php HTTP/1.0\r\n" . "Host: {$this->host}\r\n" . "Connection: close\r\n\r\n");
}
示例3: testRecordOfSentCharacters
function testRecordOfSentCharacters()
{
$site = $this->getServerInfo();
$socket = new SimpleSocket($site['host'], $site['port'], 15);
$this->assertTrue($socket->write("GET {$site['path']}network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: {$site['host']}\r\n");
$socket->write("Connection: close\r\n\r\n");
$socket->close();
$this->assertEqual($socket->getSent(), "GET {$site['path']}network_confirm.php HTTP/1.0\r\n" . "Host: {$site['host']}\r\n" . "Connection: close\r\n\r\n");
}
示例4: SimpleHttpResponse
/**
* Constructor. Reads and parses the incoming
* content and headers.
* @param SimpleSocket $socket Network connection to fetch
* response text from.
* @param SimpleUrl $url Resource name.
* @param mixed $encoding Record of content sent.
* @access public
*/
function SimpleHttpResponse(&$socket, $url, $encoding)
{
$this->SimpleStickyError();
$this->_url = $url;
$this->_encoding = $encoding;
$this->_sent = $socket->getSent();
$this->_content = false;
$raw = $this->_readAll($socket);
if ($socket->isError()) {
$this->_setError('Error reading socket [' . $socket->getError() . ']');
return;
}
$this->_parse($raw);
}
示例5: SimpleHttpResponse
/**
* Constructor. Reads and parses the incoming
* content and headers.
* @param SimpleSocket $socket Network connection to fetch
* response text from.
* @param string $method HTTP request method.
* @param SimpleUrl $url Resource name.
* @param mixed $request_data Record of content sent.
* @access public
*/
function SimpleHttpResponse(&$socket, $method, $url, $request_data = '')
{
$this->StickyError();
$this->_method = $method;
$this->_url = $url;
$this->_request_data = $request_data;
$this->_sent = $socket->getSent();
$this->_content = false;
$raw = $this->_readAll($socket);
if ($socket->isError()) {
$this->_setError('Error reading socket [' . $socket->getError() . ']');
return;
}
$this->_parse($raw);
}
示例6:
/**
* Constructor. Reads and parses the incoming
* content and headers.
* @param SimpleSocket $socket Network connection to fetch
* response text from.
* @param SimpleUrl $url Resource name.
* @param mixed $encoding Record of content sent.
* @access public
*/
function __construct($socket, $url, $encoding)
{
parent::__construct();
$this->url = $url;
$this->encoding = $encoding;
$this->sent = $socket->getSent();
$this->content = false;
$raw = $this->readAll($socket);
if ($socket->isError()) {
$this->setError('Error reading socket [' . $socket->getError() . ']');
return;
}
$this->parse($raw);
}