本文整理汇总了PHP中Proxy::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Proxy::run方法的具体用法?PHP Proxy::run怎么用?PHP Proxy::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
}
}
} while ($code && --$mr);
curl_close($rch);
if (!$mr) {
if ($maxredirect === null) {
trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING);
} else {
$maxredirect = 0;
}
return false;
}
curl_setopt($ch, CURLOPT_URL, $newurl);
}
}
return curl_exec($ch);
}
}
try {
// Use '' al default
if (isset($_GET['url'])) {
$url = $_GET['url'];
unset($_GET['url']);
} else {
$url = '';
}
$proxy = new Proxy();
echo $proxy->run($url, $_GET, $_POST);
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
示例2: run
}
}
}
static function run()
{
$self = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$path_self = @$_SERVER['PATH_TRANSLATED'] ?: $_SERVER['SCRIPT_FILENAME'];
$a = strlen($self);
$b = strlen($path_self);
$i = 0;
while ($self[$a - $i - 1] == $path_self[$b - $i - 1] && $i < 1000) {
$i++;
}
if ($i == 0) {
return;
}
self::$base_url = substr($self, 0, strlen($self) - $i);
self::$base_path = substr($path_self, 0, strlen($path_self) - $i);
self::$tea = isset($_GET['tea']);
$urls = $_REQUEST['url'];
if (!is_array($urls)) {
$urls = array($urls);
}
foreach ($urls as $url) {
self::process($url);
}
echo json_encode(self::$cache);
}
}
Proxy::run();