我正在嘗試在 guzzlehttp 中執(zhí)行 CURL 獲取請求以檢查用戶是否存在于 CRM 中。每當我嘗試執(zhí)行請求時,標題中都會出現(xiàn)以下錯誤,我無法在線找到任何資源來解決這個特定問題。任何想法都會非常有幫助,如果您需要任何其他信息,請在評論中告訴我。包含的軟件包:require(__DIR__ . "/../../vendor/autoload.php");require_once(__DIR__ . "/../../helpers/Validation.php");use Symfony\Component\Dotenv\Dotenv;use GuzzleHttp\Client;use GuzzleHttp\Request;use GuzzleHttp\RequestOptions;use GuzzleHttp\Psr7;use GuzzleHttp\Stream\Stream;use Drupal\Core\Site\Settings;// Load our environment variables$dotenv = new Dotenv();$dotenv->load(__DIR__ . "/../../.env");private function checkDuplicate() { // If no errors we can submit the registrant // \Drupal::logger('signup')->notice("access token", print_r($this->_accessToken, TRUE)); if(!$this->_errors) { $checkNewUser = new Client(); try { $options = [ 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => "Bearer " . $this->_accessToken ], "query" => '$filter=email%20eq%20"' .$this->_email . '"&$fields=Contact Key,First Name,Last Name' ]; $result = $checkNewUser->get($_ENV['REST_API_URL'], $options); } catch (RequestException $e) { \Drupal::logger('signup')->error("error " . print_r($e->getRequest(), TRUE)); if ($e->hasResponse()) { \Drupal::logger('signup')->error("error " . print_r($e->getRequest(), TRUE)); echo $e->getRequest() . "\n"; \Drupal::logger('signup')->error("error " . print_r($e->getResponse(), TRUE)); } }}我有一個發(fā)布請求功能來獲得一個正常工作的訪問令牌。private function getAccessToken() { try { $requestAccessToken = new Client(); $options = [ 'headers' => [ 'Accept' => 'application/json', ], "form_params" => [ "grant_type" => "client_credentials", "client_id" => $_ENV["CLIENT_ID"], "client_secret" => $_ENV["CLIENT_SECRET"] ] ];
調(diào)用未定義函數(shù) GuzzleHttp\Psr7\get_message_body_summary()
函數(shù)式編程
2022-10-14 10:32:09