我尝试发送cURL请求以获取付款服务的响应。 cURL请求如下所示:
curl -X POST https://secure.payu.com/pl/standard/user/oauth/authorize \
-d 'grant_type=client_credentials&client_id=CLIENTID&client_secret=CLIENTSECRET'
我在Symfony的代码是:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://secure.payu.com/pl/standard/user/oauth/authorize");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(array(
"grant_type" => "client_credentials",
"client_id" => $client_id,
"client_secret" => $client_secret
))
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close($ch);
var_dump($server_output);
但我总是假的。我该怎么做才能发送卷曲请求并从付款服务中获得答案?