"PHP Fatal error: Class 'HttpRequest' not found" "PHP Fatal error: Class 'HttpRequest' not found" php php

"PHP Fatal error: Class 'HttpRequest' not found"


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"];