I'm pretty sure there is a function to do this already but Google was absolutely no help what-so-ever. I just need something that will return a string containing the contents of a webpage (the HTML basically). How would I go about doing this, or does anyone know how what the built-in function is (if there is one)?
Wow, I need to wait a bit before I go begging for help. After much searching through the PHP documentation I found the function's name is 'file_get_contents(string url)', in case anyone else is wondering.
fopen and fread will do the trick too. $filename = "url"; // Location of the News Source $start = "code where you want to begin"; // Start Grabbing Code $stop = "code where to stop"; // Stop Grabbing Code // Get contents of the specified URL and writes it into a string $fd = fopen( $filename, "r" ); $contents = fread( $fd, 50000 ); fclose( $fd ); // Isolates desired section. if(eregi("$start(.*)$stop", $contents, $printing)) { $substring=$printing[1]; // while is added as there are multiple instances of the start en stop string & eregi // searches to include the most that matches, not the next. while(eregi("(.*)$stop", $substring, $printing)) { $substring=$printing[1]; }; PHP:
Where did I say I was scraping content? Don't assume things about people you don't know. Thanks everybody else for the helpful responses, green rep well earned