a6addon Posted June 18, 2008 Share Posted June 18, 2008 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 https://forums.phpfreaks.com/topic/110718-random-break/ Share on other sites More sharing options...
webbiedave Posted June 18, 2008 Share Posted June 18, 2008 http://us.php.net/manual/en/function.sleep.php http://us.php.net/manual/en/function.set-time-limit.php Link to comment https://forums.phpfreaks.com/topic/110718-random-break/#findComment-568068 Share on other sites More sharing options...
a6addon Posted June 18, 2008 Author Share Posted June 18, 2008 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 https://forums.phpfreaks.com/topic/110718-random-break/#findComment-568092 Share on other sites More sharing options...
MatthewJ Posted June 18, 2008 Share Posted June 18, 2008 This might seem odd, but you could just respect their wishes instead of trying to get around them Link to comment https://forums.phpfreaks.com/topic/110718-random-break/#findComment-568096 Share on other sites More sharing options...
a6addon Posted June 18, 2008 Author Share Posted June 18, 2008 But if I get up with this then I need check every price by myself. 1k+ products everyday... And if I do it by the script it doesn't change nothing for them. Link to comment https://forums.phpfreaks.com/topic/110718-random-break/#findComment-568104 Share on other sites More sharing options...
MatthewJ Posted June 19, 2008 Share Posted June 19, 2008 Well... Aside from their site not getting any of the traffic. Link to comment https://forums.phpfreaks.com/topic/110718-random-break/#findComment-569270 Share on other sites More sharing options...
DarkWater Posted June 19, 2008 Share Posted June 19, 2008 You COULD write to them and ask for them to make a product price dump for you to look at instead of using up their bandwidth and traffic. Link to comment https://forums.phpfreaks.com/topic/110718-random-break/#findComment-569280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.