CodeIgniter Forums
Can we process multiple urls at once in curlrequest - 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: Can we process multiple urls at once in curlrequest (/showthread.php?tid=87880)



Can we process multiple urls at once in curlrequest - SubrataJ - 06-13-2023

Is there any way we can process multiple URLs  in 
PHP Code:
$client = \Config\Services::curlrequest(); 


for example, this is URL set which is coming from the database itself
PHP Code:
    $urlset = [
        'https://sdocmanager.com/api/provider/receive-hooks',
        'https://sdocmanager.com/api/provider/receive-hooks',
        'https://sdocmanager.com/api/provider/receive-hooks'
    ]; 


can we process it like this 
PHP Code:
    $res $client->request('POST'$urlset, [
          'headers' => [
              'Accept'    => 'application/json',
           ],
           'json' => $clientData
    
]); 


I don't wanna iterate this as data will be the same for all the URLs. Kindly lemme know if there is any alternative way to achieve this.

Thanks in advance. Smile


RE: Can we process multiple urls at once in curlrequest - Muzikant - 06-13-2023

You can download files parallelly directly from PHP CURL with multi CURL. If I can ask you, what type of project do you making?


RE: Can we process multiple urls at once in curlrequest - SubrataJ - 06-13-2023

(06-13-2023, 02:36 AM)Muzikant Wrote: You can download files parallelly directly from PHP CURL with multi CURL. If I can ask you, what type of project do you making?

It's a document management application, basically, it has 3 panels admin, provider, and client.

they want to integrate with Zapier so I have to send data to webhook endpoints once a new client is added or updated, thus I need to know if we can do the same.