本文整理汇总了PHP中MainWP_Utility::tryVisit方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::tryVisit方法的具体用法?PHP MainWP_Utility::tryVisit怎么用?PHP MainWP_Utility::tryVisit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::tryVisit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isWebsiteAvailable
public static function isWebsiteAvailable($website)
{
$http_user = null;
$http_pass = null;
$sslVersion = null;
$verifyCertificate = null;
if (is_object($website) && isset($website->url)) {
$url = $website->url;
$verifyCertificate = isset($website->verify_certificate) ? $website->verify_certificate : null;
$http_user = $website->http_user;
$http_pass = $website->http_pass;
$sslVersion = $website->ssl_version;
} else {
$url = $website;
}
if (!self::isDomainValid($url)) {
return false;
}
return MainWP_Utility::tryVisit($url, $verifyCertificate, $http_user, $http_pass, $sslVersion);
}
示例2: mainwp_testwp
function mainwp_testwp()
{
$this->secure_request('mainwp_testwp');
$url = null;
$name = null;
$http_user = null;
$http_pass = null;
$verifyCertificate = 1;
$sslVersion = 0;
if (isset($_POST['url'])) {
$url = $_POST['url'];
$verifyCertificate = $_POST['test_verify_cert'];
$sslVersion = MainWP_Utility::getCURLSSLVersion($_POST['test_ssl_version']);
$http_user = $_POST['http_user'];
$http_pass = $_POST['http_pass'];
} else {
if (isset($_POST['siteid'])) {
$website = MainWP_DB::Instance()->getWebsiteById($_POST['siteid']);
if ($website) {
$url = $website->url;
$name = $website->name;
$verifyCertificate = $website->verify_certificate;
$sslVersion = $website->ssl_version;
$http_user = $website->http_user;
$http_pass = $website->http_pass;
}
}
}
$rslt = MainWP_Utility::tryVisit($url, $verifyCertificate, $http_user, $http_pass, $sslVersion);
if (isset($rslt['error']) && $rslt['error'] != '' && substr($url, -9) != 'wp-admin/') {
if (substr($url, -1) != '/') {
$url .= '/';
}
$url .= 'wp-admin/';
$newrslt = MainWP_Utility::tryVisit($url, $verifyCertificate, $http_user, $http_pass, $sslVersion);
if (isset($newrslt['error']) && $rslt['error'] != '') {
$rslt = $newrslt;
}
}
if ($name != null) {
$rslt['sitename'] = $name;
}
die(json_encode($rslt));
}