本文整理汇总了PHP中SimpleSocket::read方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSocket::read方法的具体用法?PHP SimpleSocket::read怎么用?PHP SimpleSocket::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSocket
的用法示例。
在下文中一共展示了SimpleSocket::read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSocketClosure
public function testSocketClosure()
{
$socket = new SimpleSocket('www.lastcraft.com', 80, 15, 8);
$this->assertTrue($socket->isOpen());
$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");
$this->assertEqual($socket->read(), "HTTP/1.1");
$socket->close();
$this->assertIdentical($socket->read(), false);
}
示例2: testSocketClosure
public function testSocketClosure()
{
$socket = new SimpleSocket($this->host, $this->port, 15, 8);
$this->assertTrue($socket->isOpen());
$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");
$this->assertEqual($socket->read(), 'HTTP/1.0');
$socket->close();
$this->assertIdentical($socket->read(), false);
}
示例3: testSocket
function testSocket()
{
$socket = new SimpleSocket("www.lastcraft.com", 80);
$this->assertFalse($socket->isError(), "Error [" . $socket->getError() . "]");
$this->assertTrue($socket->isOpen());
$this->assertTrue($socket->write("GET www.lastcraft.com/test/network_confirm.php HTTP/1.0\r\n"));
$socket->write("Host: localhost\r\n");
$socket->write("Connection: close\r\n\r\n");
$this->assertEqual($socket->read(8), "HTTP/1.1");
$socket->close();
$this->assertEqual($socket->read(8), "");
}
示例4: testSocketClosure
function testSocketClosure()
{
$site = $this->getServerInfo();
$socket = new SimpleSocket($site['host'], $site['port'], 15, 8);
$this->assertTrue($socket->isOpen());
$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");
$this->assertEqual($socket->read(), "HTTP/1.1");
$socket->close();
$this->assertIdentical($socket->read(), false);
}
示例5: while
/**
* Reads the whole of the socket output into a
* single string.
* @param SimpleSocket $socket Unread socket.
* @return string Raw output if successful
* else false.
* @access private
*/
function _readAll(&$socket)
{
$all = '';
while (!$this->_isLastPacket($next = $socket->read())) {
$all .= $next;
}
return $all;
}
示例6: readAll
/**
* Reads the whole of the socket output into a
* single string.
* @param SimpleSocket $socket Unread socket.
* @return string Raw output if successful
* else false.
* @access private
*/
protected function readAll($socket)
{
$all = '';
while (!$this->isLastPacket($next = $socket->read())) {
$all .= $next;
}
return $all;
}
示例7: while
/**
* Reads the whole of the socket output into a
* single string.
* @param SimpleSocket $socket Unread socket.
* @return string Raw output if successful
* else false.
* @access private
*/
function _readAll(&$socket) {
$all = "";
while ($next = $socket->read()) {
$all .= $next;
}
return $all;
}