Jump to content

random break


a6addon

Recommended Posts

Hi

I have big problem with my script which uses curl to scan prices at IT wholesaler website. They haven't any price list which you can  download so I must use curl to scan prices. Everything works from 2 years but now they write to many people like me to stop scan prices. They check how many products user looks in short period of time.

I haven't any idea how i can sleep executing of php script after every scanned prize (for example: it checks one product-> random break (10-40sek)->next product-> ... etc.)

Anyone have any ideas on how to do this?

Link to comment
Share on other sites

I tried sleep before but it doesn't work for me...

Here is part of the script:


$wynik=mysql_query("SELECT products_model, products_price, products_weight from products where products_model!='' ORDER BY products_model");
  while ($rekord=mysql_fetch_array ($wynik)){
    $model=$rekord[0];
    $cena_baza=$rekord[1];
    $marza=$rekord[2];


   $ch = curl_init();
   curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
   curl_setopt($ch, CURLOPT_URL, "http://wholesaler.website/item.aspx?pid=".$model);
   curl_setopt($ch, CURLOPT_USERPWD, 'user:pass');
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $result=curl_exec ($ch);
   curl_close($ch);
   

   $pos = strpos($result, 'prc = ');
   $cena = substr($result, $pos+6,;

   if ($cena!=0){
     $zapytanie = "UPDATE products SET products_price='$cena' WHERE products_model='$model'";
     $wykonaj = mysql_query ($zapytanie);
   }
}

 

How can I stop execute it after each product for random period of time?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.