最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cURL error(28) in laravel when accessing internal php files - Stack Overflow

programmeradmin2浏览0评论

I am trying to do a POST request to my classless personal-api.php file located at http:ip.address:port\public\api\personal\personal-api.php but it returns a cURL error(28)

I am using Http facade to send the POST request by

$params = [params];
$url = url('public/api/personal/personal-api.php');
Http::post($url, $params);

I tried using Http::get and I still get the cURL error(28)

I am trying to do a POST request to my classless personal-api.php file located at http:ip.address:port\public\api\personal\personal-api.php but it returns a cURL error(28)

I am using Http facade to send the POST request by

$params = [params];
$url = url('public/api/personal/personal-api.php');
Http::post($url, $params);

I tried using Http::get and I still get the cURL error(28)

Share Improve this question asked 2 days ago bitmarksssbitmarksss 111 silver badge1 bronze badge New contributor bitmarksss is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 3
  • Are you using a virtual machine such as Vagrant/Homestead, or Docker? if so, you need to remove the port from the URL, since the request will happen within the virtual machine. – aynber Commented 2 days ago
  • 3 why post to a file within your application? – kris gjika Commented 2 days ago
  • What @krisgjika wrote and thinking: Getting a cURL error(28) is a valid result of calling Http::post($url, $params);, getting it should not cause any question. Maybe the question is how to handle the error? Please clarify by editing and providing all the relevant information. – hakre Commented 2 days ago
Add a comment  | 

1 Answer 1

Reset to default 1

The error message you provide cURL error(28) indicates a timeout for your request could not be completed withing the allocated time. The reason could be an invalid URL path so check the URL path Or you can increase the timeout duration as follows for a 30 second timeout

$params = [params];
$url = url('your URL path');
$response = Http::timeout(30)->post($url, $params); // for 30 second timeout

If the server takes more time than usual, this will help resolve the issue. Otherwise, check if the server is available. If the server is not available, a request timeout can occur.

发布评论

评论列表(0)

  1. 暂无评论