I cannot cURL to local URLs in CodeIgniter 3 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: I cannot cURL to local URLs in CodeIgniter 3 (/showthread.php?tid=74509) |
I cannot cURL to local URLs in CodeIgniter 3 - andfisher - 10-04-2019 I have recently upgraded an application and environment from PHP5 to PHP7 and Codeigniter 2 to Codeigniter 3.1.11. However the application needs to curl to itself, and what used to work now gives me the following error: Quote:Operation timed out after 30000 milliseconds with 0 bytes received Here's the code, which I have tried on an external URL and works fine. Code: $fullURL = 'http://localhost/andrew/index'; I assumed it was an application problem, so I made the most basic of controllers to also test: Code: <?php ...but had the same problem. However. If I override the constructor and die before it calls its parent constructor the problem goes away Code: class Andrew extends CI_Controller The fact that as soon as the CI_controller construct is called the problem appears leads me to believe it is CodeIgniter related. How do I resolve this? In digging, what I have found is that an Exception is thrown in CI_Loader. When a cURL request, get_instance()->config is a stdClass rather than an instance of CI_Config like it is in a regular request and so has no load() method. Code: public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE) RE: I cannot cURL to local URLs in CodeIgniter 3 - dave friend - 10-04-2019 What is the exception that CI_Loader throws? |