![]() |
how to check if url exists - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: how to check if url exists (/showthread.php?tid=92745) |
how to check if url exists - cb21 - 04-12-2025 how to check if URL exists with codeigniter ? I didn't find and try to do it with simple php but it is not as easy as I read. Maybe because php change and what works 10 years ago does not work today in 2025 with php 8 (I forget the decimal) I try curl_init($url)) $headers = get_headers($url); and differents easy solution but when I really check it it accept that it should not or I got php error message Do codeigniter have already done solution ? I even try if ( file_get_contents($url, 'FILE_TEXT', NULL, 0, 1)) But I got this kind of error file_get_contents(): php_network_getaddresses: getaddrinfo for aaaaaaa failed: Temporary failure in name resolution instead of true false I try catch but always have erors impossible to say if I have any kind of error it is false RE: hot to check if url exists - kcs - 04-13-2025 Are you checking if a url exists or if a file exists? RE: hot to check if url exists - captain-sensible - 04-13-2025 lets re-phrase the question. if someone enters a URL like : domain.com/elephant does that URL cause an event like loading a view or does something else; id that what you mean ? for a view you can do something in a controller like Code: public function showView($page) rout to pick up is : Code: $routes->get('(:any)','Pages::showView/$1'); RE: how to check if url exists - InsiteFX - 04-14-2025 How to check the existence of URL in PHP? |