nanobots Posted January 1, 2010 Share Posted January 1, 2010 visit the given link = " http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=%20S&PG=L&R=N&L=NY&C=culinary%20schools&N=&T=&S=&search=Find+It " how would I write a script that will extract all data specified below from the All Listings section of the given url. Including subsequent pages where applicable. (i.e. page 2, 3, etc.) Instructions: 1. By using this format for the data. including the labels: Company name: Address: Telephone Number: Email Address: 2. The script will save the data into a text file. 3. the text file will be named as listings.txt 4. and will save the file as listings.php Link to comment https://forums.phpfreaks.com/topic/186860-how-can-i-get-a-data-from-a-url-and-save-as-txt/ Share on other sites More sharing options...
cags Posted January 1, 2010 Share Posted January 1, 2010 You can use file_get_contents or cURL to fetch the search results from the page. There are several ways to parse the data, using something like DOMDocument is probably the best option. Once you have the data stitch it together into a string and use file_put_contents to store the information into a file (or the other file functions). Link to comment https://forums.phpfreaks.com/topic/186860-how-can-i-get-a-data-from-a-url-and-save-as-txt/#findComment-986823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.