yanjchan Posted May 8, 2009 Share Posted May 8, 2009 Hi! I need help fetching the source of a web page, then searching it for a specific string. For example, fetching Google News and searching for the string "Recession" or "Layoffs". Then I could use a if... else to do a certain thing for each. Thanks! Link to comment https://forums.phpfreaks.com/topic/157307-read-web-page-into-array-find-a-string/ Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 Read up on cURL Link to comment https://forums.phpfreaks.com/topic/157307-read-web-page-into-array-find-a-string/#findComment-829134 Share on other sites More sharing options...
yanjchan Posted May 8, 2009 Author Share Posted May 8, 2009 I kind of understand cURL already, but not how to find the string in the webpage. Would I use a regex? Link to comment https://forums.phpfreaks.com/topic/157307-read-web-page-into-array-find-a-string/#findComment-829138 Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 Yeah, you can do that. Or a combination of strstr, substr, etc. Link to comment https://forums.phpfreaks.com/topic/157307-read-web-page-into-array-find-a-string/#findComment-829144 Share on other sites More sharing options...
yanjchan Posted May 8, 2009 Author Share Posted May 8, 2009 Thanks. And whenever I use cURL, I get a "301 moved" error. I've read that you have to use a -L command that will tell command line curl to fetch the redirected page, but I don't know how to do that in PHP. Could anyone help? Link to comment https://forums.phpfreaks.com/topic/157307-read-web-page-into-array-find-a-string/#findComment-829151 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.