本文整理汇总了PHP中Http::http_request方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::http_request方法的具体用法?PHP Http::http_request怎么用?PHP Http::http_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::http_request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateMail
public function updateMail()
{
$id = $this->rcpt;
$http = new Http();
$url = "http://services.ukrposhta.com/barcodesingle/default.aspx?ctl00%24centerContent%24scriptManager=ctl00%24centerContent%24scriptManager%7Cctl00%24centerContent%24btnFindBarcodeInfo&__EVENTTARGET=&__EVENTARGUMENT=&ctl00%24centerContent%24txtBarcode={$id}&__ASYNCPOST=true&ctl00%24centerContent%24btnFindBarcodeInfo=%D0%9F%D0%BE%D1%88%D1%83%D0%BA";
$data = $http->http_request(array('url' => $url, 'cookie' => true, 'redirect' => true));
$page = split("\n", $data);
$print = 0;
foreach ($page as $line) {
if ($print) {
$result = strip_tags($line) . "\n";
$print = 0;
}
if (strstr("{$line}", "divInfo")) {
if (strstr("{$line}", "</div>")) {
$result = strip_tags($line) . "\n";
} else {
$print = 1;
}
}
}
if (strstr($result, "вручене за довіреністю")) {
$this->ddate = date("Y-m-d", strtotime(mb_substr(strstr($result, "вручене за довіреністю "), 23, 10, 'UTF-8')));
$this->status = 1;
$this->update();
} elseif (strstr($result, "вручене адресату (одержувачу) особисто")) {
$this->ddate = date("Y-m-d", strtotime(mb_substr(strstr($result, "особисто "), 9, 10, 'UTF-8')));
$this->status = 1;
$this->update();
} else {
return 0;
}
}
示例2: actionGetAddress
public function actionGetAddress()
{
header('Access-Control-Allow-Origin: *');
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$uri = "http://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$lng}&language=uk&sensor=false";
$r = new Http();
echo $r->http_request($uri);
}
示例3: trackMail
public function trackMail($id)
{
$http = new Http();
$url = "http://services.ukrposhta.com/barcodesingle/default.aspx?ctl00%24centerContent%24scriptManager=ctl00%24centerContent%24scriptManager%7Cctl00%24centerContent%24btnFindBarcodeInfo&__EVENTTARGET=&__EVENTARGUMENT=&ctl00%24centerContent%24txtBarcode={$id}&__ASYNCPOST=true&ctl00%24centerContent%24btnFindBarcodeInfo=%D0%9F%D0%BE%D1%88%D1%83%D0%BA";
$a = $http->http_request(array('url' => $url, 'return' => 'array', 'cookie' => true));
$cookie = $a['headers']['SET-COOKIE'];
$url = "http://services.ukrposhta.com/barcodesingle/DownloadInfo.aspx";
$data = $http->http_request(array('url' => $url, 'cookie' => $cookie));
$page = preg_split("\n", $data);
$print = 0;
foreach ($page as $line) {
if ($print) {
$result = strip_tags($line) . "\n";
$print = 0;
}
if (strstr("{$line}", "divInfo")) {
if (strstr("{$line}", "</div>")) {
$result = strip_tags($line) . "\n";
} else {
$print = 1;
}
}
}
if (strstr($result, "вручене за довіреністю")) {
return date("Y-m-d", strtotime(mb_substr(strstr($result, "вручене за довіреністю "), 23, 10, 'UTF-8')));
} else {
return 0;
}
}