To extract data from a file, look for fread() in the manual to write the
complete file in a variable, then edit the text in the variable with some of
the string commands found, for example, at php.net/manual/en/ref.strings.php
Then choose one of the numerous databases supported by php and save whatever
you need.
You undertand that you will do all that on the server side...
Alain
On Sat, Jan 13, 2001 at 12:30:03AM -0000, James Duncan wrote:
> Hi folks,
>
> I'm still new to HTML, Javascript and PHP but learning (fast hopefully).
> I've just started accessing DOM elements. I have worked out how to update
> the contents of table cells directly using this method, etc. In Javascript I
> would use code like:
>
> alert("Value is: " +
> tablejames.firstChild.childNodes[1].childNodes[4].firstChild.firstChild.node
> Name);
> alert("Value is: " +
> tablejames.firstChild.childNodes[1].childNodes[5].firstChild.firstChild.node
> Value);
>
> This Javascript shows the name and value of the child element.
>
> Now I want to use PHP to extract data (values) from HTML pages like I do
> with the above Javascript. Is this possible? Obviously with the Javascript
> the HTML page has already been rendered in the browser (i.e. all tree
> elements have been created). This makes extracting data a simple case of
> finding the "#text" elements and reading in the values. Can I do the same
> thing with PHP and an HTML file I've downloaded from the Internet? Obviously
> this file is sitting on my server and hasn't been rendered in a browser...
>
> The whole point of this exercise is so that I can extract values from an
> HTML table and populate them into a database. Maybe it's easier to process
> the HTML file line by line and strip the unwanted HTML tags? However, with
> this approach I've got to hardcode each webpage...
>
> If this is a silly question then sorry but you only learn if you ask ;)
>
> Thanks
>
> James
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]