当发送API post请求时,它给我一个curl错误,请查看下面的详细信息,并建议如何解决此问题。
cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-
errors.html)
.env
APP_URL=http://acpapi.staging
RegisterController
$user = $this->create($request->all());
$http = new Client;
// return $http->post(env('APP_URL'));
$response = $http->post(env('APP_URL') . '/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => env('PASSWORD_CLIENT_ID'),
'client_secret' => env('PASSWORD_CLIENT_SECRET'),
'username' => $request->get('email'),
'password' => $request->get('password'),
'remember' => false,
'scope' => '',
],
]);
return $this->successResponse([
'token_data' => json_decode($response->getBody()),
'user' => [
'email' => $user->email
]
]);
错误
"cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"
发布于 2021-01-22 05:15:41
在我的例子中,我错误地将我的环境文件命名为"env“
确保它是".env“
发布于 2019-10-23 04:03:08
你可以尝试用php artisan config:clear
清除配置缓存,如果它以前被缓存过,并且你改变了它的值,这可能是原因。
此外,您还可以尝试使用this包进行内部请求。
发布于 2021-04-24 15:30:46
https://stackoverflow.com/questions/58511369
复制相似问题