'Foreach data curl
foreach ($inventories['rgDescriptions'] as $key => $description){
$samik = $description['app_data'];
$url[] = "https://api2.prices.tf/prices/".$samik["def_index"]."%3B".$samik["quality"];
}
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"accept: application/json",
"Authorization: Bearer " .$value. " ",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);
how can i run this code without having curl_init() expects parameter 1 to be string, array given
Solution 1:[1]
If you work with a framework, you better use a queue system. And while you're at it, a good framework can also do the heavy lifting of curl for you... If you don't have a good framework, Laravel might be a good start.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SomeOne_1 |
