iHack Posted October 15, 2007 Share Posted October 15, 2007 I need to use curl to get every page (in an array) from http://site.com/view.php?id=1106 to ?id=22000 getting each id page. How would I go about doing this? And could you show me a quick example? Thanks, iHack. Link to comment https://forums.phpfreaks.com/topic/73351-crawling-script-with-curl/ Share on other sites More sharing options...
trq Posted October 15, 2007 Share Posted October 15, 2007 Why do you need curl? <?php foreach(range(1106,22000) as $i) { file_put_contents('file_' . $i, file_get_contents('http://site.com/view.php?id=' . $i)) } ?> Link to comment https://forums.phpfreaks.com/topic/73351-crawling-script-with-curl/#findComment-370086 Share on other sites More sharing options...
iHack Posted October 15, 2007 Author Share Posted October 15, 2007 foreach(range(1106,12478) as $i) { file_put_contents('file_' . $i, file_get_contents('http://www.site.com/view.php?id=' . $i)) } That causes an error on the last } for some reason Link to comment https://forums.phpfreaks.com/topic/73351-crawling-script-with-curl/#findComment-370093 Share on other sites More sharing options...
papaface Posted October 15, 2007 Share Posted October 15, 2007 file_put_contents('file_' . $i, file_get_contents('http://www.site.com/view.php?id=' . $i)) theres no ; should be: file_put_contents('file_' . $i, file_get_contents('http://www.site.com/view.php?id=' . $i)); Link to comment https://forums.phpfreaks.com/topic/73351-crawling-script-with-curl/#findComment-370100 Share on other sites More sharing options...
iHack Posted October 15, 2007 Author Share Posted October 15, 2007 I realized that shortly after I posted With this, I would like to use this http://www.phpfreaks.com/forums/index.php/topic,163614.msg717462.html to get whats between the pattern from each URL. How would I do this? Thanks. Link to comment https://forums.phpfreaks.com/topic/73351-crawling-script-with-curl/#findComment-370106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.