New cURL based on another cURL result


Hello guys,
I'm new in PHP and i want to call another external API using cURL,
with this piece of code everything is good and the result is what i need.

$curl = curl_init();
		curl_setopt_array($curl, array(
		    CURLOPT_URL => $api_URL,
		    CURLOPT_USERAGENT => 'Token cURL Request'
		$resp = curl_exec($curl);

but problem starts when i want to call a new cURL base on the previous cURL after i get result.
I think i need wait for first one to complete before starting a new one but i'm beginner in php and i don't know how i can write that.


Doesn't curl_exec() not return until it has retrieved the requested resource? I can't see any mention of it being asynchronous.

What problems do you have when you try to call it a second time?


Plain cURL is processed like every other PHP script, from top to bottom. So just make another call.


Thanks for your reply , i found the problem it was a silly mistake in syntax and the log error didn't mention to that line


It most definitely is not asynchronous


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.