“PHP Fatal error: Class 'HttpRequest' not found”

别来无恙 提交于 2019-11-26 22:35:26

The class HttpRequest is provided by v1 of this PECL extension.

Re-install via: $ pecl install -f pecl_http-1.7.6

You can find documentation for v2 here, though: https://mdref.m6w6.name/http

alternatively, in case you cannot control certain environmental variables or install packages, you might try using curl which should return a json object (below is a working snippet of a google api call).

$url = 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=TOKEN_DATA_123';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$json = json_decode($response, true);
curl_close($ch);
print_r($json);
$userEmail = $json["email"];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!