Opening multiple urls with CURL – Using api with CURL – too many urls and too slow

Tags: , , ,

I have a software.

There is a table, there are URLs in this table.

There are 100 URLs on each page.


Then I got an API where I can pull Alexa and DA Values. I wanted to show these values ​​later.

$cara = str_replace(array("https://", "http://", "www."), "", $row["site_link"]);
$mara = array_shift(explode("/", $cara));
$xx = "".$mara; 

$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Connection: Keep-Alive',
    'Keep-Alive: 300'
curl_setopt($ch, CURLOPT_URL, $xx);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,0);
    curl_setopt($ch, CURLOPT_TIMEOUT_MS, 200);
    $vary = curl_exec($ch);

$result = json_decode($vary, true);


Located here;

The $row[“site_link”] variable retrieves the site header of each table from the database.

Then http, https, www. I separate the parts and add the link to the end of the API.

As myapi /, I send requests for each site and then alexa, da and pa values ​​are printed on the screen.

However, there is a big delay in doing this.

Then I print the result one by one as follows;


What should I do to stop this delay?


Is there anyone who can help?

I can manually upload the data to the database and pull it.

Like the variable $row[‘pa’]

So can I make mysql updater?

Source: stackoverflow