jamesxg1 Posted July 21, 2009 Share Posted July 21, 2009 Well this one is a bit confusing but i need to basically do this, <?php require("exe.php"); $urlrun="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=indian+delivery+in+berkshire&sll=52.173511,-0.411301&sspn=0.205075,0.441513&ie=UTF8&ll=52.089633,-0.411301&spn=0.205462,0.441513&z=11&view=text&ei=ir1kSuisJcnKjAfK-Y3cCw&mpnum=9&attrid=&sa=N&start="; $stag='<span id=title class="fn org" dir=ltr>'; $etag="</span></span>‎</div>"; $tspider = new tagSpider(); $tspider->fetchPage($urlrun); $linkarray = $tspider->parse_array($stag, $etag); foreach ($linkarray as $result) { $string = preg_replace('~<div align=left><div class=rescat>Category:.*?<span><a class=f href=/maps?f=q&source=s_q&hl=en&geocode=&q=indian+delivery+in+berkshire&sll=52.173511,-0.411301&sspn=0.205075,0.441513&ie=UTF8&view=text&ei=tvJkSuGYAoKGjAekw8CRDA&attrid=&latlng=16738287191014861748&cd=1&dtab=2&pcsi=16738287191014861748,0 log=miwd id=nrev_A>1 review</a> - <a class=f nw href=https://www.google.com/accounts/ServiceLogin?service=local&hl=en&nui=1&continue=http://maps.google.co.uk/maps%3Ff%3Dq%26source%3Ds_q%26hl%3Den%26geocode%3D%26q%3Dindian%2Bdelivery%2Bin%2Bberkshire%26sll%3D52.173511,-0.411301%26sspn%3D0.205075,0.441513%26ie%3DUTF8%26view%3Dtext%26ei%3DtvJkSuGYAoKGjAekw8CRDA%26attrid%3D%26dtab%3D2%26cid%3D16738287191014861748%26iwd%3D1%26iwloc%3DA%26action%3Dopen log=miwd id=wrev_A>Write a review</a></span></div>~is','',$result); $stringtop = preg_replace('~</a><span><a class=f href=.*?Write a review</a></span></div>~is',',',$string); $stringbottom = preg_replace('~</a><span><a class="f nw" href=https://.*?Write a review</a></span></div>~is',',',$stringtop); $stringmiddle = preg_replace('~</span>‎<div><div>.*?<span class=adr id=adr dir=ltr>~is','',$stringbottom); $stringfinal = preg_replace('~<div><a href=.*?</span></a>~is','',$stringmiddle); $bored = preg_replace('~<span .*?>~is','',$stringfinal); $verybored = preg_replace('~</sp.*?an>~is','',$bored); $sleep = preg_replace('~</di.*?v>~is','',$verybored); $close = preg_replace('~R.*?06;~is','',$sleep); $to = preg_replace('~<b.*?>~is','',$close); $death = preg_replace('~<di.*?v>~is','',$to); $done =preg_replace('~</b.*?>~is','',$death); $content = str_replace(" - ", ',', "$done"); $contentt = str_replace(",", '","', "$content"); $contents = '("' . $contentt . '"),' . "\r\n"; $open = fopen('data.txt', "a+"); $write = fwrite($open, $contents); echo $contents . "\n"; } ?> i need to make it so that once this has run and done its job it will add the number 10 to the end of $url (AKA &start=) and then run again and once that has complete change 10 to 20 and then run again so on and so on how would i do this ? James. Link to comment https://forums.phpfreaks.com/topic/166812-solved-every-refresh-add-10/ Share on other sites More sharing options...
jamesxg1 Posted July 21, 2009 Author Share Posted July 21, 2009 Sorry for the extra post, the var is $urlrun Link to comment https://forums.phpfreaks.com/topic/166812-solved-every-refresh-add-10/#findComment-879621 Share on other sites More sharing options...
jamesxg1 Posted July 21, 2009 Author Share Posted July 21, 2009 i was trying to use something like this but it dont work, <?php session_start(); $number = "0"; $_SESSION['num'] = $number; echo $number; if($_GET['do'] == 'r') { $numb = $_SESSION['num']; $numbah = $numb +10; $_SESSION['num'] = $numbah; $numberr = $_SESSION['num']; echo "<br>" .$numberr; } ?> Link to comment https://forums.phpfreaks.com/topic/166812-solved-every-refresh-add-10/#findComment-879628 Share on other sites More sharing options...
thebadbad Posted July 21, 2009 Share Posted July 21, 2009 Run your code inside a loop. Example: <?php $interval = 10; $limit = 100; for ($i = 0; $i <= $limit; $i += $interval) { $url = "..&start=$i"; //grab contents } ?> Link to comment https://forums.phpfreaks.com/topic/166812-solved-every-refresh-add-10/#findComment-879629 Share on other sites More sharing options...
jamesxg1 Posted July 21, 2009 Author Share Posted July 21, 2009 Run your code inside a loop. Example: <?php $interval = 10; $limit = 100; for ($i = 0; $i <= $limit; $i += $interval) { $url = "..&start=$i"; //grab contents } ?> Worked a charm cheers mate. Link to comment https://forums.phpfreaks.com/topic/166812-solved-every-refresh-add-10/#findComment-879636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.