本文整理汇总了PHP中Http类的典型用法代码示例。如果您正苦于以下问题:PHP Http类的具体用法?PHP Http怎么用?PHP Http使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Http类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:33,代码来源:HoleRequestSent.php
示例2: httpPostMethod
public function httpPostMethod(Http $http, array $formFields)
{
/*
* Méthode appelée en cas de requête HTTP POST
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $formFields contient l'équivalent de $_POST en PHP natif.
*/
try {
$Customer = new CustomerModel();
$verifEmail = $Customer->sameMail($formFields['Email']);
if ($verifEmail && ctype_digit($formFields['Year']) && ctype_digit($formFields['Month']) && ctype_digit($formFields['Day']) && ctype_digit($formFields['Phone']) && strlen($formFields['Phone']) === 10 && ctype_digit($formFields['ZipCode']) && strlen($formFields['ZipCode']) === 5 && isset($formFields['password']) && $formFields['password2'] == $formFields['password'] && isset($formFields['Email']) && filter_var($formFields['Email'], FILTER_VALIDATE_EMAIL) != false) {
$Birthdate = $formFields['Year'] . '-' . $formFields['Month'] . '-' . $formFields['Day'];
//var_dump($Birthdate);
$Customer_id = $Customer->registerCustomer($formFields['FirstName'], $formFields['LastName'], $Birthdate, $formFields['Phone'], $formFields['Address'], $formFields['Address2'], $formFields['City'], $formFields['ZipCode'], $formFields['Email'], $formFields['password']);
//var_dump($Customer_id);
$user = $Customer->findCustomer($Customer_id);
$UserSession = new UserSession();
$UserSession->create($user);
$http->redirectTo('');
} else {
$http->redirectTo('Exception?Error=3');
}
} catch (DomainException $event) {
$form = new RegisterForm();
$form->bind($formFields);
$form->setErrorMessage($event->getMessage());
return ['_form' => $form];
}
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:30,代码来源:UserController.class.php
示例3: httpPostMethod
public function httpPostMethod(Http $http, array $formFields)
{
/*
* Méthode appelée en cas de requête HTTP POST
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $formFields contient l'équivalent de $_POST en PHP natif.
*/
/*var_dump($formFields['bookingDate']);
var_dump($date);
var_dump($date > $formFields['bookingDate']);
die();*/
$date = new DateTime();
$userSession = new UserSession();
$bookingModel = new BookingModel();
$customerId = intval($userSession->getId());
if ($userSession->isAuthenticated()) {
$customerId = intval($userSession->getId());
$checkBookingById = $bookingModel->checkBookingById($customerId, intval($formFields['bookingId']), $formFields['bookingDate']);
if (ctype_digit($formFields['bookingId']) && $date < new DateTime($formFields['bookingDate']) && $checkBookingById) {
$bookingModel->DeletBooking($formFields['bookingId']);
$flashBag = new FlashBag();
$flashBag->add('Réservation ' . $formFields["bookingId"] . ' bien supprimée');
$http->redirectTo('/');
}
$flashBag = new FlashBag();
$flashBag->add('Problème lors de la suppression de la réservation (Vous ne pouvez supprimer des réservations posterieur à aujourd\'hui)');
$http->redirectTo('/Booking');
}
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:31,代码来源:SupbookingController.class.php
示例4: httpGetMethod
public function httpGetMethod(Http $http, array $queryFields)
{
/*
* Méthode appelée en cas de requête HTTP GET
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $queryFields contient l'équivalent de $_GET en PHP natif.
*/
//var_dump(intval($queryFields['produit_id']));
if (array_key_exists('produit_id', $queryFields)) {
if (ctype_digit($queryFields['produit_id'])) {
$meal = new MealModel();
$listMeal = $meal->find(intval($queryFields['produit_id']));
if ($listMeal) {
return ['listMeal' => $listMeal];
} else {
$http->redirectTo('Exception?Error=1');
}
} else {
$http->redirectTo('Exception?Error=2');
}
} else {
$http->redirectTo('Exception?Error=2');
//'On ne hack pas mon site !!!!!!!!!!!!!!!!', 'Image' => 'http://iletaitungeek.com/wp-content/uploads/2015/08/dark-vador-aura-sa-ps4-collector-une.jpg'];
}
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:26,代码来源:MealController.class.php
示例5: refresh
function refresh($force = false)
{
// How often to check for updates
$interval = $this->hook->apply('product_info_refresh_interval', 60 * 60 * 12);
if (!$force && isset($this->data['last_refresh']) && $this->data['last_refresh'] > time() - $interval) {
return false;
}
$http = new Http($this->config, $this->hook, $this->router);
$response = $http->get($this->config->leeflets_api_url . '/product-info?slugs=core');
if (Error::is_a($response)) {
return $response;
}
if ((int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399) {
return new Error('product_info_refresh_fail_http_status', 'Failed to refresh product info from leeflets.com. Received response ' . $response['response']['code'] . ' ' . $response['response']['message'] . '.', $response);
}
if (!($response_data = json_decode($response['body'], true))) {
return new Error('product_info_refresh_fail_json_decode', 'Failed to refresh product info from leeflets.com. Error decoding the JSON response received from the server.', $response['body']);
}
$this->data = array();
$this->data['last_refresh'] = time();
$this->data['products'] = $response_data;
$this->write();
$this->load();
return true;
}
开发者ID:pcbrsites,项目名称:leeflets,代码行数:25,代码来源:product-info.php
示例6: testGetParameters
public function testGetParameters()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET['captain'] = 'kirk';
$request = new Http();
$this->assertEquals('kirk', $request->getParameter('captain'));
}
开发者ID:poliander,项目名称:janeiro,代码行数:7,代码来源:HttpTest.php
示例7: httpPostMethod
public function httpPostMethod(Http $http, array $formFields)
{
/*
* Méthode appelée en cas de requête HTTP POST
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $formFields contient l'équivalent de $_POST en PHP natif.
*/
$userSession = new UserSession();
if ($userSession->isAdminAuthenticated() == false) {
$http->redirectTo('/');
}
//var_dump($formFields);
//var_dump($_FILES);
if (array_key_exists('Modification', $formFields)) {
if ($http->hasUploadedFile('Photo')) {
$pathinfo = $http->moveUploadedFile('Photo', '/images/meals');
var_dump($pathinfo);
$mealModel = new MealModel();
$mealModel->modifyPicture($pathinfo, $formFields['Id']);
}
$mealModel = new MealModel();
$result = $mealModel->modifyMeal($formFields['Name'], $formFields['Description'], $formFields['QuantityInStock'], $formFields['BuyPrice'], $formFields['SalePrice'], $formFields['Id']);
$http->redirectTo('/Admin/List');
} elseif (ctype_digit($formFields['meal_Id'])) {
$mealModel = new MealModel();
$meal = $mealModel->find($formFields['meal_Id']);
return ['meal' => $meal];
}
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:30,代码来源:ModificationController.class.php
示例8: httpPostMethod
public function httpPostMethod(Http $http, array $formFields)
{
/*
* Méthode appelée en cas de requête HTTP POST
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $formFields contient l'équivalent de $_POST en PHP natif.
*/
/*$date = new DateModel();
var_dump($date->testDate($formFields['dateResa'])); //0 FAUX - 1 VRAI REJEX */
$userSession = new UserSession();
if ($userSession->isAuthenticated()) {
$dateTime = date_create($formFields['dateResa'] . ' ' . $formFields['timeResa']);
$now = new DateTime("now");
$resaDate = date_format($dateTime, 'Y-m-d');
$resaTime = date_format($dateTime, 'H:i:s');
//var_dump($formFields);
if (!empty($formFields['dateResa']) && !empty($formFields['timeResa']) && !empty($formFields['NumberOfSeats']) && $dateTime > $now && ctype_digit($formFields['NumberOfSeats'])) {
$userId = $userSession->getId();
$Booking = new BookingModel();
$resultat = $Booking->register($userId, $resaDate, $resaTime, $formFields['NumberOfSeats']);
return ['resultat' => $resultat];
} elseif ($dateTime < $now) {
return ['Error' => 'Nous ne pouvons vous réserver une table pour une date antérieur à aujourd\'hui'];
} else {
return ['Error' => 'Un champ n\'a pas était remplie correctement'];
}
} else {
echo 'lu';
die;
$http->redirectTo('/');
}
}
开发者ID:annacrea,项目名称:ChezPaolo,代码行数:33,代码来源:BookingController.class.php
示例9: httpPostMethod
public function httpPostMethod(Http $http, array $formFields)
{
/*
* Méthode appelée en cas de requête HTTP POST
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $formFields contient l'équivalent de $_POST en PHP natif.
*/
$Customer = new CustomerModel();
$verifEmail = $Customer->sameMail($formFields['Email']);
//var_dump(strlen($_POST['Phone']));
//var_dump(strlen($_POST['ZipCode']));
if ($verifEmail['result'] === '0' && ctype_digit($formFields['Year']) && ctype_digit($formFields['Month']) && ctype_digit($formFields['Day']) && ctype_digit($formFields['Phone']) && strlen($formFields['Phone']) === 10 && ctype_digit($formFields['ZipCode']) && strlen($formFields['ZipCode']) === 5 && isset($formFields['password']) && isset($formFields['Email']) && filter_var($formFields['Email'], FILTER_VALIDATE_EMAIL) != false) {
$password = password_hash($formFields['password'], PASSWORD_DEFAULT);
//var_dump($password);
$Birthdate = $formFields['Year'] . '-' . $formFields['Month'] . '-' . $formFields['Day'];
//var_dump($Birthdate);
$Customer_id = $Customer->registerCustomer($formFields['FirstName'], $formFields['LastName'], $Birthdate, $formFields['Phone'], $formFields['Address'], $formFields['Address2'], $formFields['City'], $formFields['ZipCode'], $formFields['Email'], $formFields['password']);
//var_dump($Customer_id);
$user = $Customer->findCustomer($Customer_id);
$UserSession = new UserSession();
$UserSession->create($user);
$http->redirectTo('');
} elseif ($verifEmail != '0') {
$http->redirectTo('Exception?Error=3');
}
}
开发者ID:annacrea,项目名称:ChezPaolo,代码行数:27,代码来源:UserController.class.php
示例10: isNewBrowscapVersion
function isNewBrowscapVersion()
{
if (!isset($_SESSION['user_browscap_version'])) {
$_SESSION['user_browscap_version'] = getCurrentBrowscapRelease();
}
if (!isset($_SESSION['server_browscap_version'])) {
$server_browscap_version = "";
if (extension_loaded('soap')) {
$http = new Http();
$http->setTimeout(2);
$http->execute("http://www.website-php.com/en/webservices/wsp-information-server.wsdl?wsdl");
$wsdl = $http->getResult();
if ($wsdl != "" && find($wsdl, "<?xml", 1) > 0) {
$client = new WebSitePhpSoapClient("http://www.website-php.com/en/webservices/wsp-information-server.wsdl?wsdl");
$server_browscap_version = $client->getBrowscapVersionNumber();
}
} else {
/*$http = new Http();
$http->setTimeout(2);
$http->execute("http://browsers.garykeith.com/versions/version-number.asp");
$server_browscap_version = $http->getResult();*/
$server_browscap_version = "";
}
if (trim($server_browscap_version) != "") {
$_SESSION['server_browscap_version'] = $server_browscap_version;
}
}
if (trim($_SESSION['user_browscap_version']) != trim($_SESSION['server_browscap_version'])) {
return trim($_SESSION['server_browscap_version']);
}
return false;
}
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:32,代码来源:utils-version.inc.php
示例11: httpGetMethod
public function httpGetMethod(Http $http, array $queryFields)
{
if (isset($_GET['logout']) && $_GET['logout'] == 'out') {
$userSession = new UserSession();
$userSession->destroy();
$http->redirectTo('/');
}
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:8,代码来源:LogoutController.class.php
示例12: 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);
}
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:9,代码来源:EventController.php
示例13: getTicket
/**
* 获取jsticket
*
* @return string
*/
public function getTicket()
{
$key = 'overtrue.wechat.jsapi_ticket' . $this->appId;
return $this->cache->get($key, function ($key) {
$http = new Http(new AccessToken($this->appId, $this->appSecret));
$result = $http->get(self::API_TICKET);
$this->cache->set($key, $result['ticket'], $result['expires_in']);
return $result['ticket'];
});
}
开发者ID:emilymwang8,项目名称:ajk-broker,代码行数:15,代码来源:Js.php
示例14: post_func
function post_func($url, $params, $files)
{
$http = new Http($this->key);
if ($http->upload($url, $params, $files)) {
//var_export($http->get_data());
return json_decode($http->get_data(), true);
} else {
return array('result' => false, 'error' => 7.1);
}
}
开发者ID:zeus911,项目名称:versionSwitchTool,代码行数:10,代码来源:VersionSwitch.php
示例15: httpGetMethod
public function httpGetMethod(Http $http, array $queryFields)
{
/*
* Méthode appelée en cas de requête HTTP GET
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $queryFields contient l'équivalent de $_GET en PHP natif.
*/
$http->refreshTo(10, '');
return ['Error' => $queryFields['Error']];
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:11,代码来源:ExceptionController.class.php
示例16: httpGetMethod
public function httpGetMethod(Http $http, array $queryFields)
{
/*
* Méthode appelée en cas de requête HTTP GET
*
* L'argument $http est un objet permettant de faire des redirections etc.
* L'argument $queryFields contient l'équivalent de $_GET en PHP natif.
*/
$userSession = new UserSession();
if ($userSession->isAdminAuthenticated() == false) {
$http->redirectTo('/');
}
}
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:13,代码来源:AddController.class.php
示例17: uploadIndexPic
public function uploadIndexPic()
{
if (!$_FILES) {
$this->ReportError('请选择文件');
}
if ($this->settings['App_publishsys']) {
$postFields = array('a' => 'uploadIndexPic', 'file' => $_FILES, 'request' => 'admin/magic_update.php');
$objHttp = new Http($this->settings['App_publishsys']['host'], $this->settings['App_publishsys']['dir']);
$hgDataReturn = $objHttp->http($postFields);
echo json_encode($hgDataReturn);
} else {
$this->ReportError('此系统未安装');
}
}
开发者ID:h3len,项目名称:Project,代码行数:14,代码来源:plug.php
示例18: trans
private static function trans($message, $mode)
{
$http = new Http();
$http->vars("v", $mode);
$http->vars("text", $message);
if (Tag::setof($tag, $http->do_post("http://lou5.jp/")->body(), "body")) {
foreach ($tag->in('p') as $p) {
if ($p->inParam("class") == "large align-left box") {
$message = $p->value();
}
}
}
return $message;
}
开发者ID:hisaboh,项目名称:w2t,代码行数:14,代码来源:Lou.php
示例19: download
public function download()
{
import('ORG.Net.Http');
header("Content-Type:text/html;charset=UTF-8");
$title = I('get.title');
$file_dir = './Public/upload/';
$Resource = D('Resource');
$map['id'] = I('get.id');
$list = $Resource->where($map)->order('id desc')->find();
$name = $list['content'];
$filename = $file_dir . $name;
$download = new Http();
$download->download($filename, $showtitle);
}
开发者ID:highestgoodlikewater,项目名称:lexiang,代码行数:14,代码来源:ResourceActAction.class.php
示例20: getToken
/**
* 获取Token
*
* @return string
*/
public function getToken()
{
if ($this->token) {
return $this->token;
}
$thisObj = $this;
return $this->cache->get($this->cacheKey, function () use($thisObj) {
$params = array('appid' => $thisObj->appId, 'secret' => $thisObj->appSecret, 'grant_type' => 'client_credential');
$http = new Http();
$token = $http->get($thisObj::API_TOKEN_GET, $params);
$thisObj->cache->set($thisObj->cacheKey, $token['access_token'], $token['expires_in']);
return $thisObj->token = $token['access_token'];
});
}
开发者ID:emilymwang8,项目名称:ajk-broker,代码行数:19,代码来源:AccessToken.php
注:本文中的Http类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论