[SOLVED]HTTP request API - 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: [SOLVED]HTTP request API (/showthread.php?tid=89126) Pages:
1
2
|
[SOLVED]HTTP request API - pippuccio76 - 01-12-2024 HI , im newbe for API , i want to send a request to a dispenser to know the product inside im . In the explanation of the dispenser API every request must be with the autentication credential , send in the header of request . To see list of product must call : https://www.dispenserweb.com/API/DispenserParsedAPI/GetProdotti How can i implement a controller to do this request ? RE: HTTP request API - InsiteFX - 01-12-2024 Your url link is not working. RE: HTTP request API - pippuccio76 - 01-12-2024 (01-12-2024, 06:22 AM)InsiteFX Wrote: Your url link is not working. Is an example the real url is https://www.sinapsiweb.com/API/SinapsiParsedAPI/GetProdotti ( i don't know if i can insert real url) RE: HTTP request API - InsiteFX - 01-13-2024 Well it still does not work, can you give us a link to this API so that we can look at it? RE: HTTP request API - pippuccio76 - 01-13-2024 (01-13-2024, 05:37 AM)InsiteFX Wrote: Well it still does not work, can you give us a link to this API so that we can look at it? I have only a PDF , but i want know how can i request external data by passing credential in header . Can i do only with curl or must i do in another way? RE: HTTP request API - kenjis - 01-13-2024 See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#headers RE: HTTP request API - pippuccio76 - 01-15-2024 (01-13-2024, 05:40 PM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#headers hi , this is my code : Code: public function getDPIdispenser() I have this error : 22 : The requested URL returned error: 401 In postman work only if i work as this screenshot https://ibb.co/KFDGDn6 How can i do this with code ? edit: Solved by this code : $response = $client->request('GET', $uri , ['auth' => ['xxxxx', 'xxxxxx', 'basic']]); RE: [SOLVED]HTTP request API - pippuccio76 - 01-16-2024 Another problem with request : TRY this: Code: public function getTransazionidispenser() with tis error : CodeIgniter\HTTP\Exceptions\HTTPException 3 : and this : Code: public function getTransazionidispenser() CodeIgniter\HTTP\Exceptions\HTTPException 22 : The requested URL returned error: 500 in postman work fine : https://ibb.co/GVvKPph what can i do to pass parameter to query ? RE: [SOLVED]HTTP request API - kenjis - 01-16-2024 See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#query and auth is also documented: https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#auth RE: [SOLVED]HTTP request API - pippuccio76 - 01-16-2024 (01-16-2024, 12:42 AM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#query is exactely the second code i have posted , but doesn't work , codeigniter return an incomprehensible error what mean : CodeIgniter\HTTP\Exceptions\HTTPException 3 : sorry with second code return 500... this is the log : Code: CRITICAL - 2024-01-16 08:51:59 --> CodeIgniter\HTTP\Exceptions\HTTPException: 22 : The requested URL returned error: 500 |