本文整理汇总了PHP中Illuminate\Support\Facades\Request::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getContent方法的具体用法?PHP Request::getContent怎么用?PHP Request::getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::getContent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleWebhook
/**
* Handle a Stripe webhook call.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handleWebhook()
{
$payload = (array) json_decode(Request::getContent(), true);
$method = 'handle' . studly_case(str_replace('.', '_', $payload['type']));
if (method_exists($this, $method)) {
return $this->{$method}($payload);
} else {
return $this->missingMethod();
}
}
示例2: login
public function login()
{
$raw = json_decode(Request::getContent());
$user = User::where('name', $raw->name)->where('password', $raw->pass)->firstOrFail();
return Response::json(['status_code' => 200, 'data' => $user]);
// return redirect()->intended('dashboard');
// }
// abort(403, "You're not authorized to access this public REST API.");
// $auth = auth()->guard('api');
// if ($auth->check()) {
// return $auth->user();
// };
// abort(403, "You're not authorized to access this public REST API.");
}
示例3: handle
/**
* Handles the request made to StyleCI by the GitHub API.
*
* @return \Illuminate\Http\JsonResponse
*/
public function handle()
{
$class = 'StyleCI\\StyleCI\\Events\\Repo\\GitHub\\GitHub' . ucfirst(camel_case(Request::header('X-GitHub-Event'))) . 'Event';
if (!class_exists($class)) {
throw new BadRequestHttpException('Event not supported.');
}
$data = Request::input();
$repo = Repo::find($data['repository']['id']);
if (!$repo) {
throw new BadRequestHttpException('Request integrity validation failed.');
}
list($algo, $sig) = explode('=', Request::header('X-Hub-Signature'));
$hash = hash_hmac($algo, Request::getContent(), $repo->token);
if (!Str::equals($hash, $sig)) {
throw new BadRequestHttpException('Request integrity validation failed.');
}
event(new $class($repo, $data));
return new JsonResponse(['message' => 'Event successfully received.']);
}
示例4: getJsonPayload
/**
* Get the JSON payload for the request.
*
* @return array
*/
protected function getJsonPayload()
{
return (array) json_decode(Request::getContent(), true);
}
示例5: __construct
public function __construct()
{
$k2Data = Request::getContent();
$this->k2 = new K2($k2Data);
}
示例6: validateMD5Data
/**
* Validate the request MD5 data header.
*
* @param string $clientSecret
* @return boolean
*/
public function validateMD5Data($clientSecret = '')
{
$md5 = $this->header('CONTENT_MD5');
if (parent::isJson()) {
$content = parent::getContent();
if (empty($md5) and empty($content)) {
return true;
}
return md5($content . $clientSecret) == $md5;
}
$input = $this->all();
if (!empty($input)) {
foreach ($input as $key => $item) {
if (str_contains($key, '/')) {
unset($input[$key]);
}
}
}
if (empty($md5) and empty($input)) {
return true;
}
return md5(http_build_query($input) . $clientSecret) == $md5;
}
示例7: notify
/**
*
* 支付结果通用通知
* @param function $callback
* 直接回调函数使用方法: notify(you_function);
* 回调类成员函数方法:notify(array($this, you_function));
* $callback 原型为:function function_name($data){}
*/
public static function notify($callback, &$msg)
{
//获取通知的数据
$xml = Request::getContent();
//$GLOBALS['HTTP_RAW_POST_DATA'];
//如果返回成功则验证签名
try {
$result = PayResults::Init($xml);
} catch (WxException $e) {
$msg = $e->errorMessage();
return false;
}
return call_user_func($callback, $result);
}