Modernvox Posted October 24, 2009 Author Share Posted October 24, 2009 #<a href="(/[a-z]{3}/\d{10}\.html)"># # - opening delimiter <a href=" - literal string ie find this exact pattern ( - start a new capture group / - literal forward slash (as all the links start with a forward slash) [a-z]{3} - 3 letters / - literal forward slash \d{10} - a 10 digit number \. - a full stop character (the backslash escapes it as it is a special character) html - another literal string ) - close capture group "> - yet more literal characters # - ending delimiter Wow..finally explained the way i can understand it- Thank You! Quote Link to comment https://forums.phpfreaks.com/topic/178815-solved-small-stringcant-get-the-right-combo-to-pull-it-in/page/2/#findComment-943710 Share on other sites More sharing options...
cags Posted October 24, 2009 Share Posted October 24, 2009 If you set $url = "http://newjersey.craigslist.org/sss/"; before calling file_get_contents($url); it should do pretty much the same as the curl approach with substantially less code. Quote Link to comment https://forums.phpfreaks.com/topic/178815-solved-small-stringcant-get-the-right-combo-to-pull-it-in/page/2/#findComment-943711 Share on other sites More sharing options...
Modernvox Posted October 24, 2009 Author Share Posted October 24, 2009 If you set $url = "http://newjersey.craigslist.org/sss/"; before calling file_get_contents($url); it should do pretty much the same as the curl approach with substantially less code. Do you use Curl? Can PHP do the same tasks as Curl? I''m still a newbie and wondering if i should even concern myself with curl or stick with php? Quote Link to comment https://forums.phpfreaks.com/topic/178815-solved-small-stringcant-get-the-right-combo-to-pull-it-in/page/2/#findComment-943712 Share on other sites More sharing options...
cags Posted October 24, 2009 Share Posted October 24, 2009 The curl approach is far more powerfull and will enable you to have more control, but for simple scraping file_get_contents is just as good and a darn site easier (IMO). Quote Link to comment https://forums.phpfreaks.com/topic/178815-solved-small-stringcant-get-the-right-combo-to-pull-it-in/page/2/#findComment-943717 Share on other sites More sharing options...
Daniel0 Posted October 24, 2009 Share Posted October 24, 2009 curl can also download in parallel, which is useful if you are going to download multiple files. Quote Link to comment https://forums.phpfreaks.com/topic/178815-solved-small-stringcant-get-the-right-combo-to-pull-it-in/page/2/#findComment-943720 Share on other sites More sharing options...
Modernvox Posted October 25, 2009 Author Share Posted October 25, 2009 Great thanks for the insight guys. Much appreciated.. Quote Link to comment https://forums.phpfreaks.com/topic/178815-solved-small-stringcant-get-the-right-combo-to-pull-it-in/page/2/#findComment-943732 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.