скручиваемая реакция не понятна - PullRequest
0 голосов
/ 29 мая 2019

когда я отправляю запрос curl для получения access_token, ответ или результат не понятен человеку

когда моя аутентификация завершается, мой URL перенаправления переносится в list ()

public function list()
{
      $url = 'https://login.mailchimp.com/oauth2/token';
      $data = [
        'grant_type' => 'authorization_code',
        'client_id' => 2xxxxx177380,
        'client_secret' => '4b02xxxx21dcd32d5406a7d',
        'redirect_uri' => 'http://127.0.0.1:8000/success',
        'code' => $_GET['code']
        ];
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $response = curl_exec ($ch);
     $err = curl_error($ch);  //if you need
     curl_close ($ch);
     return $response;
    }

thisэто то, что я получил в результате, где ссылка перенаправления: http://127.0.0.1:8000/list?access_token=9be9d4b1d724a0b19c7f4aff677b2b69&expires_in=0 ответ:

��VJ- * � / R�R�� + K��L� / J-, M-.Q6

1 Ответ

0 голосов
/ 29 мая 2019

это что-нибудь меняет?

curl_setopt($ch, CURLOPT_HTTPHEADER, 'text/plain;charset=UTF-8');
curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
...