Jump to content

How can I get a data from a url and save as .txt


nanobots

Recommended Posts

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

 

 

 

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).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.