本文整理汇总了PHP中DokuHTTPClient::sendRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP DokuHTTPClient::sendRequest方法的具体用法?PHP DokuHTTPClient::sendRequest怎么用?PHP DokuHTTPClient::sendRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DokuHTTPClient
的用法示例。
在下文中一共展示了DokuHTTPClient::sendRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendData
/**
* Send the data, to the submit url
*
* @param string $data The popularity data
* @return string An empty string if everything worked fine, a string describing the error otherwise
*/
function sendData($data)
{
$error = '';
$httpClient = new DokuHTTPClient();
$status = $httpClient->sendRequest($this->submitUrl, array('data' => $data), 'POST');
if (!$status) {
$error = $httpClient->error;
}
return $error;
}
示例2: retrieveResponse
/**
* Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
* They should return, in string form, the response body and throw an exception on error.
*
* @param UriInterface $endpoint
* @param mixed $requestBody
* @param array $extraHeaders
* @param string $method
*
* @return string
*
* @throws TokenResponseException
*/
public function retrieveResponse(UriInterface $endpoint, $requestBody, array $extraHeaders = array(), $method = 'POST')
{
$http = new \DokuHTTPClient();
$http->headers = array_merge($http->headers, $extraHeaders);
$ok = $http->sendRequest($endpoint->getAbsoluteUri(), $requestBody, $method);
if (!$ok) {
throw new TokenResponseException($http->error);
}
return $http->resp_body;
}
示例3: sendRequest
/**
* Remeber HTTPClient Cookie after successfull authentication
*/
function sendRequest($url, $data = '', $method = 'GET')
{
$returnCode = parent::sendRequest($url, $data, $method);
if ($this->settings->cookie == null) {
$this->settings->cookie = $this->cookies;
}
return $returnCode;
}
示例4: check
//.........这里部分代码省略.........
if ($conf['authtype'] == 'plain') {
global $config_cascade;
if (is_writable($config_cascade['plainauth.users']['default'])) {
msg('conf/users.auth.php is writable', 1);
} else {
msg('conf/users.auth.php is not writable', 0);
}
}
if (function_exists('mb_strpos')) {
if (defined('UTF8_NOMBSTRING')) {
msg('mb_string extension is available but will not be used', 0);
} else {
msg('mb_string extension is available and will be used', 1);
if (ini_get('mbstring.func_overload') != 0) {
msg('mb_string function overloading is enabled, this will cause problems and should be disabled', -1);
}
}
} else {
msg('mb_string extension not available - PHP only replacements will be used', 0);
}
if (!UTF8_PREGSUPPORT) {
msg('PHP is missing UTF-8 support in Perl-Compatible Regular Expressions (PCRE)', -1);
}
if (!UTF8_PROPERTYSUPPORT) {
msg('PHP is missing Unicode properties support in Perl-Compatible Regular Expressions (PCRE)', -1);
}
$loc = setlocale(LC_ALL, 0);
if (!$loc) {
msg('No valid locale is set for your PHP setup. You should fix this', -1);
} elseif (stripos($loc, 'utf') === false) {
msg('Your locale <code>' . hsc($loc) . '</code> seems not to be a UTF-8 locale, you should fix this if you encounter problems.', 0);
} else {
msg('Valid locale ' . hsc($loc) . ' found.', 1);
}
if ($conf['allowdebug']) {
msg('Debugging support is enabled. If you don\'t need it you should set $conf[\'allowdebug\'] = 0', -1);
} else {
msg('Debugging support is disabled', 1);
}
if ($INFO['userinfo']['name']) {
msg('You are currently logged in as ' . $INPUT->server->str('REMOTE_USER') . ' (' . $INFO['userinfo']['name'] . ')', 0);
msg('You are part of the groups ' . join($INFO['userinfo']['grps'], ', '), 0);
} else {
msg('You are currently not logged in', 0);
}
msg('Your current permission for this page is ' . $INFO['perm'], 0);
if (is_writable($INFO['filepath'])) {
msg('The current page is writable by the webserver', 0);
} else {
msg('The current page is not writable by the webserver', 0);
}
if ($INFO['writable']) {
msg('The current page is writable by you', 0);
} else {
msg('The current page is not writable by you', 0);
}
// Check for corrupted search index
$lengths = idx_listIndexLengths();
$index_corrupted = false;
foreach ($lengths as $length) {
if (count(idx_getIndex('w', $length)) != count(idx_getIndex('i', $length))) {
$index_corrupted = true;
break;
}
}
foreach (idx_getIndex('metadata', '') as $index) {
if (count(idx_getIndex($index . '_w', '')) != count(idx_getIndex($index . '_i', ''))) {
$index_corrupted = true;
break;
}
}
if ($index_corrupted) {
msg('The search index is corrupted. It might produce wrong results and most
probably needs to be rebuilt. See
<a href="http://www.dokuwiki.org/faq:searchindex">faq:searchindex</a>
for ways to rebuild the search index.', -1);
} elseif (!empty($lengths)) {
msg('The search index seems to be working', 1);
} else {
msg('The search index is empty. See
<a href="http://www.dokuwiki.org/faq:searchindex">faq:searchindex</a>
for help on how to fix the search index. If the default indexer
isn\'t used or the wiki is actually empty this is normal.');
}
// rough time check
$http = new DokuHTTPClient();
$http->max_redirect = 0;
$http->timeout = 3;
$http->sendRequest('http://www.dokuwiki.org', '', 'HEAD');
$now = time();
if (isset($http->resp_headers['date'])) {
$time = strtotime($http->resp_headers['date']);
$diff = $time - $now;
if (abs($diff) < 4) {
msg("Server time seems to be okay. Diff: {$diff}s", 1);
} else {
msg("Your server's clock seems to be out of sync! Consider configuring a sync with a NTP server. Diff: {$diff}s");
}
}
}