Skip to content
Advertisement

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

I have a software.

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

There are 100 URLs on each page.

picture

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

<?php
$cara = str_replace(array("https://", "http://", "www."), "", $row["site_link"]);
$mara = array_shift(explode("/", $cara));
$xx = "https://seo-rank.my-addr.com/api1/myapi/".$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);
    curl_close($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 / site.com, 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;

‘.$result[‘da’].’

What should I do to stop this delay?

Advertisement

Answer

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?

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement