![]() |
Read file to another server - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Read file to another server (/showthread.php?tid=90485) |
Read file to another server - pippuccio76 - 03-25-2024 HI , i want read file from another server , the file are xls and i want read with phpspreadsheet , i try to use curl : Code: $client = \Config\Services::curlrequest([ but i have always $code equals to 200 and $reason equal to ok i f file doesn't exist too. How can i check if file exist and read or download ? RE: Read file to another server - kenjis - 03-25-2024 See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#using-responses RE: Read file to another server - pippuccio76 - 03-26-2024 (03-25-2024, 06:35 PM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#using-responses the documentation doesn't explain how i can get the file ( to read or download) ,there is an example ? i try to : Code: $client = \Config\Services::curlrequest([ But i return a 404 Edit : i miss a x (xslx) now i haven't error , but how can i read the file ? print_r($client->getBody()) return a blank page RE: Read file to another server - pippuccio76 - 03-26-2024 Why cannot i use Code: $file = new \CodeIgniter\Files\File($url); RE: Read file to another server - kenjis - 03-26-2024 I recommend you read the user guide, because it tells everything you need in most cases. https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#using-responses PHP Code: $client = \Config\Services::curlrequest(); RE: Read file to another server - pippuccio76 - 03-27-2024 (03-26-2024, 05:07 PM)kenjis Wrote: I recommend you read the user guide, because it tells everything you need in most cases. sorry but Code: file_put_contents Build your first application part... RE: Read file to another server - kenjis - 03-27-2024 file_put_contents() is a basic PHP function. It is not CodeIgniter's function. CodeIgniter is build on PHP, so you can use PHP functions, and you should know PHP. Also, you can improve the user guide. Because CodeIgniter is made by contributions. https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html You can see "Edit this page" in right of the top. |