本文整理汇总了PHP中nzedb\utility\Misc::streamSslContextOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::streamSslContextOptions方法的具体用法?PHP Misc::streamSslContextOptions怎么用?PHP Misc::streamSslContextOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nzedb\utility\Misc
的用法示例。
在下文中一共展示了Misc::streamSslContextOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initiateStream
/**
* Initiate stream socket to IRC server.
*
* @access protected
*/
protected function _initiateStream()
{
$this->_closeStream();
$socket = stream_socket_client($this->_remote_socket_string, $error_number, $error_string, $this->_remote_connection_timeout, STREAM_CLIENT_CONNECT, stream_context_create(Misc::streamSslContextOptions(true)));
if ($socket === false) {
echo 'ERROR: ' . $error_string . ' (' . $error_number . ')' . PHP_EOL;
} else {
$this->_socket = $socket;
}
}
示例2: fetchShowQuickInfo
public function fetchShowQuickInfo($show, array $options = [])
{
$defaults = ['exact' => '', 'episode' => ''];
$options += $defaults;
$ret = [];
if (!$show) {
return false;
}
$url = $this->showQuickInfoURL . urlencode($show);
$url .= !empty($options['episode']) ? '&ep=' . urlencode($options['episode']) : '';
$url .= !empty($options['exact']) ? '&exact=' . urlencode($options['exact']) : '';
$fp = fopen($url, "r", false, stream_context_create(Misc::streamSslContextOptions()));
if ($fp) {
while (!feof($fp)) {
$line = fgets($fp, 1024);
list($sec, $val) = explode('@', $line, 2);
$val = trim($val);
switch ($sec) {
case 'Show ID':
$ret['rageid'] = $val;
break;
case 'Show Name':
$ret['name'] = $val;
break;
case 'Show URL':
$ret['url'] = $val;
break;
case 'Premiered':
$ret['premier'] = $val;
break;
case 'Country':
$ret['country'] = $val;
break;
case 'Status':
$ret['status'] = $val;
break;
case 'Classification':
$ret['classification'] = $val;
break;
case 'Genres':
$ret['genres'] = $val;
break;
case 'Network':
$ret['network'] = $val;
break;
case 'Airtime':
$ret['airtime'] = $val;
break;
case 'Latest Episode':
list($ep, $title, $airdate) = explode('^', $val);
$ret['episode']['latest'] = $ep . ", \"" . $title . "\" aired on " . $airdate;
break;
case 'Next Episode':
list($ep, $title, $airdate) = explode('^', $val);
$ret['episode']['next'] = $ep . ", \"" . $title . "\" airs on " . $airdate;
break;
case 'Episode Info':
list($ep, $title, $airdate) = explode('^', $val);
$ret['episode']['info'] = $ep . ", \"" . $title . "\" aired on " . $airdate;
break;
case 'Episode URL':
$ret['episode']['url'] = $val;
break;
case '':
break;
default:
break;
}
}
fclose($fp);
return $ret;
}
return false;
}