Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 14th, 2005, 04:14 AM
Registered User
 
Join Date: Mar 2005
Location: Ballarat, Victoria, Australia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Html > csv format

Hi
I would like to know if there is a tutorial on creating a PHP script to read and extract data from a html file (data set out in database table format) to convert it to csv or even sql for MySQL database.

Thanks. Pat

 
Old March 27th, 2005, 10:01 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Depends on the structure of the HTML file. In which case, if I could answer that the HTML file was well-formed and could pass for XML I'd look at tutorials for reading and parsing XML, which many methods exist. There is also the DOM extension to PHP, and it might be just as easy to parse the data using that extension. Start with the PHP manual:

http://www.php.net/manual/en/ref.dom.php
http://www.php.net/manual/en/ref.simplexml.php
http://www.php.net/manual/en/function.fputcsv.php

Then you can search Google for examples of these in action.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old March 27th, 2005, 06:39 PM
Registered User
 
Join Date: Mar 2005
Location: Ballarat, Victoria, Australia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Rich
Yes the files are well formed. Not sure about the xml but the html tags are the same and don't change from week to week.

Will take your advice and read up on the suggested links

Thanks Pat





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change excel into csv format Ivanchan Excel VBA 4 July 5th, 2007 02:02 AM
Exporting Report to CSV format. chakravarthy_vr Reporting Services 4 March 20th, 2006 07:27 AM
Achitecture ? SQL -> XML -> ASP -> PDF or HTML Frm jstrong Classic ASP XML 0 July 9th, 2005 01:18 PM
HELP: XSL -> HTML <select selected=true> jedbartlett XSLT 4 October 7th, 2004 11:16 PM
exporting to csv format dazednconfused Beginning PHP 1 July 11th, 2003 03:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.