php-windows Digest 14 Jan 2001 00:01:25 -0000 Issue 395

Topics (messages 4966 through 4991):

Re: PHP Editor
        4966 by: Matt Anderson
        4989 by: Michael Cartmel

Viewing PCL files
        4967 by: Emore, Emmanuel

php + seagate crystal reports
        4968 by: Christoph Aigner

RTF Files Library...
        4969 by: Andres Salazar

Re: Simple question that I can't find the answer to
        4970 by: Jan Walter
        4974 by: Sean Bright
        4983 by: L Forrister
        4984 by: L Forrister
        4985 by: L Forrister
        4986 by: L Forrister
        4987 by: L Forrister

Re: DOM
        4971 by: Michael Stearne
        4972 by: James Duncan
        4973 by: Michael Stearne
        4975 by: James Duncan
        4976 by: Michael Stearne
        4979 by: James Duncan
        4980 by: Corn Vollney-R7019C
        4981 by: Michael Stearne
        4982 by: James Duncan
        4988 by: Cynic
        4990 by: James Duncan
        4991 by: Cynic

How to correctly handle textual form inputs for SQL inserts/updates?
        4977 by: Mike Flynn

Dynamic pages
        4978 by: Dark

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------


I personally use WinEdit 2000 for my Windows based PHP coding.  Color-coded
language syntax and multiple editing tabs for files... check it out anyway.
I'm not sure of the URL, but a search on Google or most likely even Tucows
would find it.

Hope it helps!

----- Original Message -----
From: James Brash <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 13, 2001 10:54 PM
Subject: [PHP-WIN] PHP Editor


> Someone recently suggested a good PHP editor - similar to notepad. After
> reformatting, I lost the program and the url... anyone remember it ?
Thanks
> if you can help
>
>
> --
> 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]





HomeSite or ColdFusion Studio work great as well... plenty of colour coding
etc...

----- Original Message -----
From: "Matt Anderson" <[EMAIL PROTECTED]>
To: "James Brash" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, January 14, 2001 12:28 AM
Subject: Re: [PHP-WIN] PHP Editor


> I personally use WinEdit 2000 for my Windows based PHP coding.
Color-coded
> language syntax and multiple editing tabs for files... check it out
anyway.
> I'm not sure of the URL, but a search on Google or most likely even Tucows
> would find it.
>
> Hope it helps!
>
> ----- Original Message -----
> From: James Brash <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, January 13, 2001 10:54 PM
> Subject: [PHP-WIN] PHP Editor
>
>
> > Someone recently suggested a good PHP editor - similar to notepad. After
> > reformatting, I lost the program and the url... anyone remember it ?
> Thanks
> > if you can help
> >
> >
> > --
> > 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]
>





Does anybody know of a way of viewing PCL files using PHP that will not cost
a lot of $$$? I am currently reviewing a product called call SwiftView but
it cost a lot of $$$.

Thanks




hello,

is it possible to create seagate reports with php?. is there any extension
avaliable, some kind of sdk?

regards

christoph aigner

--
Christoph Aigner, CTO
Alaris Informationsmanagement GmbH
Paltaufgasse 16 / A-1160 Wien
Tel: +43-1 486 34 45
Mobil: +43-676 84 98 94 10
http://www.alaris.at






Hi,

Anyone knows where is a library to build RTF with PHP or where I can get
the RTF file format to build one on my own.

Thanx

Andres Salazar





If you are working with numbers, which is perhaps not your case, you can use
this simple trick to swith values of $a and $b:

$a = $a + $b;
$b = $a - $b;
$a = $a - $b;
--
__________________________________________________________________________________________

==========================================================================================

Jan Walter, called John
LERACH, s.r.o.
phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61
on emergency call cell phone: +420-602-385 760
work e-mail mailto:[EMAIL PROTECTED]
private e-mail mailto:[EMAIL PROTECTED]
ICQ#: 28353428
__________________________________________________________________________________________

==========================================================================================







Yeah, but you could run into overflow problems with large values of a
and b.

Sean

Jan Walter wrote:
> 
> If you are working with numbers, which is perhaps not your case, you can use
> this simple trick to swith values of $a and $b:
> 
> $a = $a + $b;
> $b = $a - $b;
> $a = $a - $b;
> --
> 
>__________________________________________________________________________________________
> 
> 
>==========================================================================================
> 
> Jan Walter, called John
> LERACH, s.r.o.
> phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61
> on emergency call cell phone: +420-602-385 760
> work e-mail mailto:[EMAIL PROTECTED]
> private e-mail mailto:[EMAIL PROTECTED]
> ICQ#: 28353428
> 
>__________________________________________________________________________________________
> 
> 
>==========================================================================================
> 
> --
> 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]




This doesn't directly address your question but it may be worth being aware of.  

Depending on which database you're using and how complex the query is and any 
resulting performance hit, you could try something like: 
  $sql = "select * from table_by_date 
          where date_field between $from_date and $to_date 
             or date_field between $to_date and $from_date"
  // the reverse order between condition may be illegal in some SQL dialects, but it's 
accepted by MySQL and postgreSQL

   
  $sql = "select * from table_by_date 
          where (date_field >= $from_date and date_field <= $to_date) 
             or (date_field >= $to_date and date_field <= $from_date)"
  // the less than/greater than alternative to between is acceptable in all SQL's... 
most SQL's just convert the between form to this any way...
In either case the same result is returned, since the reverse order condition(s) 
returns no rows and the proper order condition(s) returns the desired row set.  
~~LF

  ----- Original Message ----- 
  From: Asendorf, John 
  To: Daniel Beulshausen ; Asendorf, John ; Php-Windows (E-mail) 
  Sent: Friday, January 12, 2001 12:26 PM
  Subject: RE: [PHP-WIN] Simple question that I can't find the answer to


  I have a set of date selectors which then people can use to search between
  two dates.  Even though they say FROM and TO, people will undoubtedly put
  the dates in the wrong order on occassion.  If this happens (I've already
  got the IF statement), I want to be able to switch the two dates before the
  SQL is written instead of having it 

  die ("Hey idiot, go back and switch the dates you've entered");

  :)

  ---------------------
  John Asendorf - [EMAIL PROTECTED]
  Web Applications Developer
  http://www.lcounty.com - NEW FEATURES ADDED DAILY!
  Licking County, Ohio, USA
  740-349-3631

  The benefit to the government of replacing all $1 Federal Reserve notes with
  $1 coins would be $522.2 million per year, according to estimates of the
  General Accouting Office released on April 7, 2000.


  > -----Original Message-----
  > From: Daniel Beulshausen [mailto:[EMAIL PROTECTED]]
  > Sent: Friday, January 12, 2001 3:29 PM
  > To: Asendorf, John; Php-Windows (E-mail)
  > Subject: Re: [PHP-WIN] Simple question that I can't find the answer to
  > 
  > 
  > At 14:19 12.01.2001 -0500, Asendorf, John wrote:
  > >Is there a single line of code to do the following?
  > >
  > >I'm trying to interchange two variables' contents...  I can 
  > do it with the
  > >following, but I was just wondering...  I can't find it if 
  > there is...
  > >
  > >$a = "abc";
  > >$b = "def";
  > >
  > >$temp = $b;
  > >$b = $a;
  > >$a = $temp;
  > >
  > >//now $a = "def" and $b = "abc"
  > 
  > the question would be why you have to exchange the 
  > variablenames, maybe you 
  > can use variable variables $$ or  ${}.
  > i depends on what you want to do.
  > 
  > daniel
  > 
  > 
  > /*--
  > daniel beulshausen - [EMAIL PROTECTED]
  > using php on windows? http://www.php4win.de
  > 
  > 
  > -- 
  > 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]





All of these "tricks" to exchange the contents of two variables, while possessing a 
certain elegance, share one common defect.  They are tricky.  Days, weeks and months 
later they can and likely will be difficult to understand.  This kind of trickiness 
may have a place deep in the internals of a package such as PHP or an OS kernel, but 
in a routine to edit user inputs clarity is probably a more important virtue.  I 
suggest the best way to handle the situation originally posted would be something 
like: 

if $userFromDate > $userToDate {
    $sqlFromDate = $userToDate;
    $sqlToDate = $userFromDate;
}
else {
    $sqlToDate = $userToDate;
    $sqlFromDate = $userFromDate;
}

"Tricks" obviously do make interesting discussion topics though.  
~~LF

  ----- Original Message ----- 
  From: Sean Bright 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, January 13, 2001 10:01 AM
  Subject: Re: [PHP-WIN] Simple question that I can't find the answer to


  Yeah, but you could run into overflow problems with large values of a
  and b.

  Sean

  Jan Walter wrote:
  > 
  > If you are working with numbers, which is perhaps not your case, you can use
  > this simple trick to swith values of $a and $b:
  > 
  > $a = $a + $b;
  > $b = $a - $b;
  > $a = $a - $b;
  > --
  > 
__________________________________________________________________________________________
  > 
  > 
==========================================================================================
  > 
  > Jan Walter, called John
  > LERACH, s.r.o.
  > phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61
  > on emergency call cell phone: +420-602-385 760
  > work e-mail mailto:[EMAIL PROTECTED]
  > private e-mail mailto:[EMAIL PROTECTED]
  > ICQ#: 28353428
  > 
__________________________________________________________________________________________
  > 
  > 
==========================================================================================
  > 
  > --
  > 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]





All of these "tricks" to exchange the contents of two variables, while possessing a 
certain elegance, share one common defect.  They are tricky.  Days, weeks and months 
later they can and likely will be difficult to understand.  This kind of trickiness 
may have a place deep in the internals of a package such as PHP or an OS kernel, but 
in a routine to edit user inputs clarity is probably a more important virtue.  I 
suggest the best way to handle the situation originally posted would be something 
like: 

if $userFromDate > $userToDate {
    $sqlFromDate = $userToDate;
    $sqlToDate = $userFromDate;
}
else {
    $sqlToDate = $userToDate;
    $sqlFromDate = $userFromDate;
}

"Tricks" obviously do make interesting discussion topics though.  
~~LF

  ----- Original Message ----- 
  From: Sean Bright 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, January 13, 2001 10:01 AM
  Subject: Re: [PHP-WIN] Simple question that I can't find the answer to


  Yeah, but you could run into overflow problems with large values of a
  and b.

  Sean

  Jan Walter wrote:
  > 
  > If you are working with numbers, which is perhaps not your case, you can use
  > this simple trick to swith values of $a and $b:
  > 
  > $a = $a + $b;
  > $b = $a - $b;
  > $a = $a - $b;
  > --
  > 
__________________________________________________________________________________________
  > 
  > 
==========================================================================================
  > 
  > Jan Walter, called John
  > LERACH, s.r.o.
  > phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61
  > on emergency call cell phone: +420-602-385 760
  > work e-mail mailto:[EMAIL PROTECTED]
  > private e-mail mailto:[EMAIL PROTECTED]
  > ICQ#: 28353428
  > 
__________________________________________________________________________________________
  > 
  > 
==========================================================================================
  > 
  > --
  > 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]





All of these "tricks" to exchange the contents of two variables, while possessing a 
certain elegance, share one common defect.  They are tricky.  Days, weeks and months 
later they can and likely will be difficult to understand.  This kind of trickiness 
may have a place deep in the internals of a package such as PHP or an OS kernel, but 
in a routine to edit user inputs clarity is probably a more important virtue.  I 
suggest the best way to handle the situation originally posted would be something 
like: 

if $userFromDate > $userToDate {
    $sqlFromDate = $userToDate;
    $sqlToDate = $userFromDate;
}
else {
    $sqlToDate = $userToDate;
    $sqlFromDate = $userFromDate;
}

"Tricks" obviously do make interesting discussion topics though.  
~~LF

  ----- Original Message ----- 
  From: Sean Bright 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, January 13, 2001 10:01 AM
  Subject: Re: [PHP-WIN] Simple question that I can't find the answer to


  Yeah, but you could run into overflow problems with large values of a
  and b.

  Sean

  Jan Walter wrote:
  > 
  > If you are working with numbers, which is perhaps not your case, you can use
  > this simple trick to swith values of $a and $b:
  > 
  > $a = $a + $b;
  > $b = $a - $b;
  > $a = $a - $b;
  > --
  > 
__________________________________________________________________________________________
  > 
  > 
==========================================================================================
  > 
  > Jan Walter, called John
  > LERACH, s.r.o.
  > phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61
  > on emergency call cell phone: +420-602-385 760
  > work e-mail mailto:[EMAIL PROTECTED]
  > private e-mail mailto:[EMAIL PROTECTED]
  > ICQ#: 28353428
  > 
__________________________________________________________________________________________
  > 
  > 
==========================================================================================
  > 
  > --
  > 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]





Sorry for the multiple post.  Sometimes the mouse buttons on this lap top...
~~LF





Could you do something like:

myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].firstChild.firstChild.node
 Value; 

Set up a form of hidden fields.  Extract the values from the DOM and then have the 
user hit a Submit button to get to the next page.  At that point the values that were 
collected and put into the hidden form fields will be submitted and you next page (the 
PHP page) could INSERT the values into the database,

Michael


On Friday, January 12, 2001, at 07:30 PM, 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] 
>  
>  
>  




I don't think this will work in my case because I don't control the layout
of the HTML page and hence can't add the hidden fields. I'm downloading the
HTML pages from a website. It would require as much work to insert the
hidden fields as trying to strip the HTML tags in an attempt to read the
data directly from the HTML page itself. There must be a way to access the
DOM directly from PHP? I notice in the manual there is a section regarding
XML DOM but not the DOM itself.

Are the DOM values only available on the client? If that's the case then PHP
can't be used to read them because it's limited to the server side?

Thanks

James

-----Original Message-----
From: Michael Stearne [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 17:06
To: James Duncan
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] DOM

Could you do something like:

myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first
Child.firstChild.node Value;

Set up a form of hidden fields.  Extract the values from the DOM and then
have the user hit a Submit button to get to the next page.  At that point
the values that were collected and put into the hidden form fields will be
submitted and you next page (the PHP page) could INSERT the values into the
database,

Michael


On Friday, January 12, 2001, at 07:30 PM, 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]
>
>
>






On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote:

> I don't think this will work in my case because I don't control the layout 
> of the HTML page and hence can't add the hidden fields. I'm downloading the 
> HTML pages from a website. It would require as much work to insert the 
> hidden fields as trying to strip the HTML tags in an attempt to read the 
> data directly from the HTML page itself. There must be a way to access the 
> DOM directly from PHP? I notice in the manual there is a section regarding 
> XML DOM but not the DOM itself. 
>  
> Are the DOM values only available on the client? If that's the case then PHP 
> can't be used to read them because it's limited to the server side? 

Well by the time you are talking about PHP is out of the picture.  PHP can be used to 
generate a DOM but once its generated PHP (or any server side language) is out of the 
picture, it then goes to the client-side stuff like you said. You can use PHP's 
fopen() to grab the page and then add the form and hidden fields I was talking about.  
By doing this, you are setting up the page to be handled correctly by the Javascript 
code you inserted through PHP.

Michael

>  
> Thanks 
>  
> James 
>  
> -----Original Message----- 
> From: Michael Stearne [mailto:[EMAIL PROTECTED]] 
> Sent: 13 January 2001 17:06 
> To: James Duncan 
> Cc: [EMAIL PROTECTED] 
> Subject: Re: [PHP-WIN] DOM 
>  
> Could you do something like: 
>  
> myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first 
> Child.firstChild.node Value; 
>  
> Set up a form of hidden fields.  Extract the values from the DOM and then 
> have the user hit a Submit button to get to the next page.  At that point 
> the values that were collected and put into the hidden form fields will be 
> submitted and you next page (the PHP page) could INSERT the values into the 
> database, 
>  
> Michael 
>  
>  
> On Friday, January 12, 2001, at 07:30 PM, 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] 
> > 
> > 
> > 
>  
>  
>  




But surely if I'm using fopen to insert a hidden form and fields I might as
well use fopen to extract the data from the HTML page in the first place? It
just seems so much easier to capture the #text node values from the DOM,
rather than using fopen to locate the same information!?!

Another idea would be to use my Javascript to capture the text node values
from the DOM and write it to a cookie file. The contents of the cookie file
could then by read by PHP to populate the database?

Thanks

James


-----Original Message-----
From: Michael Stearne [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 17:32
To: James Duncan
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM


On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote:

> I don't think this will work in my case because I don't control the layout
> of the HTML page and hence can't add the hidden fields. I'm downloading
the
> HTML pages from a website. It would require as much work to insert the
> hidden fields as trying to strip the HTML tags in an attempt to read the
> data directly from the HTML page itself. There must be a way to access the
> DOM directly from PHP? I notice in the manual there is a section regarding
> XML DOM but not the DOM itself.
>
> Are the DOM values only available on the client? If that's the case then
PHP
> can't be used to read them because it's limited to the server side?

Well by the time you are talking about PHP is out of the picture.  PHP can
be used to generate a DOM but once its generated PHP (or any server side
language) is out of the picture, it then goes to the client-side stuff like
you said. You can use PHP's fopen() to grab the page and then add the form
and hidden fields I was talking about.  By doing this, you are setting up
the page to be handled correctly by the Javascript code you inserted through
PHP.

Michael

>
> Thanks
>
> James
>
> -----Original Message-----
> From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> Sent: 13 January 2001 17:06
> To: James Duncan
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] DOM
>
> Could you do something like:
>
>
myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first
> Child.firstChild.node Value;
>
> Set up a form of hidden fields.  Extract the values from the DOM and then
> have the user hit a Submit button to get to the next page.  At that point
> the values that were collected and put into the hidden form fields will be
> submitted and you next page (the PHP page) could INSERT the values into
the
> database,
>
> Michael
>
>
> On Friday, January 12, 2001, at 07:30 PM, 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]
> >
> >
> >
>
>
>





No, actually I think that using PHP to insert the FORM and then use Javascript to get 
the #text node values would be easier.  Parsing Table cells using RegExs is no fun.

Michael

On Saturday, January 13, 2001, at 01:06 PM, James Duncan wrote:

> But surely if I'm using fopen to insert a hidden form and fields I might as 
> well use fopen to extract the data from the HTML page in the first place? It 
> just seems so much easier to capture the #text node values from the DOM, 
> rather than using fopen to locate the same information!?! 
>  
> Another idea would be to use my Javascript to capture the text node values 
> from the DOM and write it to a cookie file. The contents of the cookie file 
> could then by read by PHP to populate the database? 
>  
> Thanks 
>  
> James 
>  
>  
> -----Original Message----- 
> From: Michael Stearne [mailto:[EMAIL PROTECTED]] 
> Sent: 13 January 2001 17:32 
> To: James Duncan 
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
> Subject: RE: [PHP-WIN] DOM 
>  
>  
> On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote: 
>  
> > I don't think this will work in my case because I don't control the layout 
> > of the HTML page and hence can't add the hidden fields. I'm downloading 
> the 
> > HTML pages from a website. It would require as much work to insert the 
> > hidden fields as trying to strip the HTML tags in an attempt to read the 
> > data directly from the HTML page itself. There must be a way to access the 
> > DOM directly from PHP? I notice in the manual there is a section regarding 
> > XML DOM but not the DOM itself. 
> > 
> > Are the DOM values only available on the client? If that's the case then 
> PHP 
> > can't be used to read them because it's limited to the server side? 
>  
> Well by the time you are talking about PHP is out of the picture.  PHP can 
> be used to generate a DOM but once its generated PHP (or any server side 
> language) is out of the picture, it then goes to the client-side stuff like 
> you said. You can use PHP's fopen() to grab the page and then add the form 
> and hidden fields I was talking about.  By doing this, you are setting up 
> the page to be handled correctly by the Javascript code you inserted through 
> PHP. 
>  
> Michael 
>  
> > 
> > Thanks 
> > 
> > James 
> > 
> > -----Original Message----- 
> > From: Michael Stearne [mailto:[EMAIL PROTECTED]] 
> > Sent: 13 January 2001 17:06 
> > To: James Duncan 
> > Cc: [EMAIL PROTECTED] 
> > Subject: Re: [PHP-WIN] DOM 
> > 
> > Could you do something like: 
> > 
> > 
> myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first 
> > Child.firstChild.node Value; 
> > 
> > Set up a form of hidden fields.  Extract the values from the DOM and then 
> > have the user hit a Submit button to get to the next page.  At that point 
> > the values that were collected and put into the hidden form fields will be 
> > submitted and you next page (the PHP page) could INSERT the values into 
> the 
> > database, 
> > 
> > Michael 
> > 
> > 
> > On Friday, January 12, 2001, at 07:30 PM, 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] 
>  
>  
>  




Hi again,

Thanks for your help so far. I will explain what I'm trying to achieve. I
want to pull down a web page that contains share prices, extract those share
prices, and update a database with the new prices. What I want is a nice and
neat solution that runs like a service (i.e. I can stop and start it from a
web browser, change the update interval (how long it waits before it repeats
the process)), etc.

I know a little PHP and Javascript (what I've taught/learnt over the last
few weeks). The process I have so far (not implemented at all yet):

1) PHP script that pulls down the relevant web page to my server
2) Data extraction from HTML web page
3) Updating of database with data from step 2
4) Running step 1 again after a certain period of time

Step 2 is the most complex by far. I was hoping to use PHP to access the
#text value via DOM but obviously this isn't possible because the DOM
doesn't exist server-side but only after the HTML has been rendered
client-side. Like you say, I could create a form and hidden fields in the
HTML file and use Javascript to read the #text node values into the hidden
fields. Then trigger a POST operation, where I can read in all the values
but I don't like the sound of this because then I would have to have a
browser interacting with my PHP scripts!?! I'm trying to create a
self-contained "service" that doesn't have any external dependants.

Is there any other way of accomplishing this without involving a browser?
The only other way I can see is to use PHP to strip all HTML tags, leaving
just the text? I could then write PHP code to read in the remaining text,
etc.

What is the best way to accomplish this? Is there a PHP command that strips
all HTML tags (and Javascript, etc) from an HTML file? Example code would be
great ;)

Thanks

James


-----Original Message-----
From: Michael Stearne [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 18:40
To: James Duncan
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM

No, actually I think that using PHP to insert the FORM and then use
Javascript to get the #text node values would be easier.  Parsing Table
cells using RegExs is no fun.

Michael

On Saturday, January 13, 2001, at 01:06 PM, James Duncan wrote:

> But surely if I'm using fopen to insert a hidden form and fields I might
as
> well use fopen to extract the data from the HTML page in the first place?
It
> just seems so much easier to capture the #text node values from the DOM,
> rather than using fopen to locate the same information!?!
>
> Another idea would be to use my Javascript to capture the text node values
> from the DOM and write it to a cookie file. The contents of the cookie
file
> could then by read by PHP to populate the database?
>
> Thanks
>
> James
>
>
> -----Original Message-----
> From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> Sent: 13 January 2001 17:32
> To: James Duncan
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] DOM
>
>
> On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote:
>
> > I don't think this will work in my case because I don't control the
layout
> > of the HTML page and hence can't add the hidden fields. I'm downloading
> the
> > HTML pages from a website. It would require as much work to insert the
> > hidden fields as trying to strip the HTML tags in an attempt to read the
> > data directly from the HTML page itself. There must be a way to access
the
> > DOM directly from PHP? I notice in the manual there is a section
regarding
> > XML DOM but not the DOM itself.
> >
> > Are the DOM values only available on the client? If that's the case then
> PHP
> > can't be used to read them because it's limited to the server side?
>
> Well by the time you are talking about PHP is out of the picture.  PHP can
> be used to generate a DOM but once its generated PHP (or any server side
> language) is out of the picture, it then goes to the client-side stuff
like
> you said. You can use PHP's fopen() to grab the page and then add the form
> and hidden fields I was talking about.  By doing this, you are setting up
> the page to be handled correctly by the Javascript code you inserted
through
> PHP.
>
> Michael
>
> >
> > Thanks
> >
> > James
> >
> > -----Original Message-----
> > From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> > Sent: 13 January 2001 17:06
> > To: James Duncan
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP-WIN] DOM
> >
> > Could you do something like:
> >
> >
>
myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first
> > Child.firstChild.node Value;
> >
> > Set up a form of hidden fields.  Extract the values from the DOM and
then
> > have the user hit a Submit button to get to the next page.  At that
point
> > the values that were collected and put into the hidden form fields will
be
> > submitted and you next page (the PHP page) could INSERT the values into
> the
> > database,
> >
> > Michael
> >
> >
> > On Friday, January 12, 2001, at 07:30 PM, 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]
>
>
>





James,

If you are the owner of the dowloaded html page you could use WDDX. Check it
out at WDDX.org.

Voll

-----Original Message-----
From: James Duncan [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 13, 2001 8:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM


Hi again,

Thanks for your help so far. I will explain what I'm trying to achieve. I
want to pull down a web page that contains share prices, extract those share
prices, and update a database with the new prices. What I want is a nice and
neat solution that runs like a service (i.e. I can stop and start it from a
web browser, change the update interval (how long it waits before it repeats
the process)), etc.

I know a little PHP and Javascript (what I've taught/learnt over the last
few weeks). The process I have so far (not implemented at all yet):

1) PHP script that pulls down the relevant web page to my server
2) Data extraction from HTML web page
3) Updating of database with data from step 2
4) Running step 1 again after a certain period of time

Step 2 is the most complex by far. I was hoping to use PHP to access the
#text value via DOM but obviously this isn't possible because the DOM
doesn't exist server-side but only after the HTML has been rendered
client-side. Like you say, I could create a form and hidden fields in the
HTML file and use Javascript to read the #text node values into the hidden
fields. Then trigger a POST operation, where I can read in all the values
but I don't like the sound of this because then I would have to have a
browser interacting with my PHP scripts!?! I'm trying to create a
self-contained "service" that doesn't have any external dependants.

Is there any other way of accomplishing this without involving a browser?
The only other way I can see is to use PHP to strip all HTML tags, leaving
just the text? I could then write PHP code to read in the remaining text,
etc.

What is the best way to accomplish this? Is there a PHP command that strips
all HTML tags (and Javascript, etc) from an HTML file? Example code would be
great ;)

Thanks

James


-----Original Message-----
From: Michael Stearne [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 18:40
To: James Duncan
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM

No, actually I think that using PHP to insert the FORM and then use
Javascript to get the #text node values would be easier.  Parsing Table
cells using RegExs is no fun.

Michael

On Saturday, January 13, 2001, at 01:06 PM, James Duncan wrote:

> But surely if I'm using fopen to insert a hidden form and fields I might
as
> well use fopen to extract the data from the HTML page in the first place?
It
> just seems so much easier to capture the #text node values from the DOM,
> rather than using fopen to locate the same information!?!
>
> Another idea would be to use my Javascript to capture the text node values
> from the DOM and write it to a cookie file. The contents of the cookie
file
> could then by read by PHP to populate the database?
>
> Thanks
>
> James
>
>
> -----Original Message-----
> From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> Sent: 13 January 2001 17:32
> To: James Duncan
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] DOM
>
>
> On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote:
>
> > I don't think this will work in my case because I don't control the
layout
> > of the HTML page and hence can't add the hidden fields. I'm downloading
> the
> > HTML pages from a website. It would require as much work to insert the
> > hidden fields as trying to strip the HTML tags in an attempt to read the
> > data directly from the HTML page itself. There must be a way to access
the
> > DOM directly from PHP? I notice in the manual there is a section
regarding
> > XML DOM but not the DOM itself.
> >
> > Are the DOM values only available on the client? If that's the case then
> PHP
> > can't be used to read them because it's limited to the server side?
>
> Well by the time you are talking about PHP is out of the picture.  PHP can
> be used to generate a DOM but once its generated PHP (or any server side
> language) is out of the picture, it then goes to the client-side stuff
like
> you said. You can use PHP's fopen() to grab the page and then add the form
> and hidden fields I was talking about.  By doing this, you are setting up
> the page to be handled correctly by the Javascript code you inserted
through
> PHP.
>
> Michael
>
> >
> > Thanks
> >
> > James
> >
> > -----Original Message-----
> > From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> > Sent: 13 January 2001 17:06
> > To: James Duncan
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP-WIN] DOM
> >
> > Could you do something like:
> >
> >
>
myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first
> > Child.firstChild.node Value;
> >
> > Set up a form of hidden fields.  Extract the values from the DOM and
then
> > have the user hit a Submit button to get to the next page.  At that
point
> > the values that were collected and put into the hidden form fields will
be
> > submitted and you next page (the PHP page) could INSERT the values into
> the
> > database,
> >
> > Michael
> >
> >
> > On Friday, January 12, 2001, at 07:30 PM, 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]
>
>
>


-- 
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]




Send a url that points to the page you want to strip the info from.  Or look into 
another service or site that may give you the quotes in a raw text format.  Also look 
into the http://www.php.net/manual/en/function.strip-tags.php function in PHP.

Michael

On Saturday, January 13, 2001, at 03:11 PM, James Duncan wrote:

> Hi again, 
>  
> Thanks for your help so far. I will explain what I'm trying to achieve. I 
> want to pull down a web page that contains share prices, extract those share 
> prices, and update a database with the new prices. What I want is a nice and 
> neat solution that runs like a service (i.e. I can stop and start it from a 
> web browser, change the update interval (how long it waits before it repeats 
> the process)), etc. 
>  
> I know a little PHP and Javascript (what I've taught/learnt over the last 
> few weeks). The process I have so far (not implemented at all yet): 
>  
> 1) PHP script that pulls down the relevant web page to my server 
> 2) Data extraction from HTML web page 
> 3) Updating of database with data from step 2 
> 4) Running step 1 again after a certain period of time 
>  
> Step 2 is the most complex by far. I was hoping to use PHP to access the 
> #text value via DOM but obviously this isn't possible because the DOM 
> doesn't exist server-side but only after the HTML has been rendered 
> client-side. Like you say, I could create a form and hidden fields in the 
> HTML file and use Javascript to read the #text node values into the hidden 
> fields. Then trigger a POST operation, where I can read in all the values 
> but I don't like the sound of this because then I would have to have a 
> browser interacting with my PHP scripts!?! I'm trying to create a 
> self-contained "service" that doesn't have any external dependants. 
>  
> Is there any other way of accomplishing this without involving a browser? 
> The only other way I can see is to use PHP to strip all HTML tags, leaving 
> just the text? I could then write PHP code to read in the remaining text, 
> etc. 
>  
> What is the best way to accomplish this? Is there a PHP command that strips 
> all HTML tags (and Javascript, etc) from an HTML file? Example code would be 
> great ;) 
>  
> Thanks 
>  
> James 
>  
>  
> -----Original Message----- 
> From: Michael Stearne [mailto:[EMAIL PROTECTED]] 
> Sent: 13 January 2001 18:40 
> To: James Duncan 
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
> Subject: RE: [PHP-WIN] DOM 
>  
> No, actually I think that using PHP to insert the FORM and then use 
> Javascript to get the #text node values would be easier.  Parsing Table 
> cells using RegExs is no fun. 
>  
> Michael 
>  
> On Saturday, January 13, 2001, at 01:06 PM, James Duncan wrote: 
>  
> > But surely if I'm using fopen to insert a hidden form and fields I might 
> as 
> > well use fopen to extract the data from the HTML page in the first place? 
> It 
> > just seems so much easier to capture the #text node values from the DOM, 
> > rather than using fopen to locate the same information!?! 
> > 
> > Another idea would be to use my Javascript to capture the text node values 
> > from the DOM and write it to a cookie file. The contents of the cookie 
> file 
> > could then by read by PHP to populate the database? 
> > 
> > Thanks 
> > 
> > James 
> > 
> > 
> > -----Original Message----- 
> > From: Michael Stearne [mailto:[EMAIL PROTECTED]] 
> > Sent: 13 January 2001 17:32 
> > To: James Duncan 
> > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
> > Subject: RE: [PHP-WIN] DOM 
> > 
> > 
> > On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote: 
> > 
> > > I don't think this will work in my case because I don't control the 
> layout 
> > > of the HTML page and hence can't add the hidden fields. I'm downloading 
> > the 
> > > HTML pages from a website. It would require as much work to insert the 
> > > hidden fields as trying to strip the HTML tags in an attempt to read the 
> > > data directly from the HTML page itself. There must be a way to access 
> the 
> > > DOM directly from PHP? I notice in the manual there is a section 
> regarding 
> > > XML DOM but not the DOM itself. 
> > > 
> > > Are the DOM values only available on the client? If that's the case then 
> > PHP 
> > > can't be used to read them because it's limited to the server side? 
> > 
> > Well by the time you are talking about PHP is out of the picture.  PHP can 
> > be used to generate a DOM but once its generated PHP (or any server side 
> > language) is out of the picture, it then goes to the client-side stuff 
> like 
> > you said. You can use PHP's fopen() to grab the page and then add the form 
> > and hidden fields I was talking about.  By doing this, you are setting up 
> > the page to be handled correctly by the Javascript code you inserted 
> through 
> > PHP. 
> > 
> > Michael 
> > 
> > > 
> > > Thanks 
> > > 
> > > James 
> > > 
> > > -----Original Message----- 
> > > From: Michael Stearne [mailto:[EMAIL PROTECTED]] 
> > > Sent: 13 January 2001 17:06 
> > > To: James Duncan 
> > > Cc: [EMAIL PROTECTED] 
> > > Subject: Re: [PHP-WIN] DOM 
> > > 
> > > Could you do something like: 
> > > 
> > > 
> > 
> myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first 
> > > Child.firstChild.node Value; 
> > > 
> > > Set up a form of hidden fields.  Extract the values from the DOM and 
> then 
> > > have the user hit a Submit button to get to the next page.  At that 
> point 
> > > the values that were collected and put into the hidden form fields will 
> be 
> > > submitted and you next page (the PHP page) could INSERT the values into 
> > the 
> > > database, 
> > > 
> > > Michael 
> > > 
> > > 
> > > On Friday, January 12, 2001, at 07:30 PM, 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] 
> > 
> > 
> > 
>  
>  
>  




Interesting. WDDX doesn't solve my problem of grabbing the content because
the supplier only provides it in HTML form but once I have the data I can
use WDDX as another way of making the data available to the world. Thanks
for the info.

I don't suppose you know of a way to push WDDX data packets to clients? For
example, after I've updated a field (for example, an updated price) in my
central database I would like to push it out to all my WDDX enabled clients
(obviously only the ones connected to the net/my server at the time) - like
a server push. I'm assuming the only way is to do a client pull - get the
client to ask the server via a WDDX request if there is any new data since
the client's last request. If I do a client pull I will have all the clients
polling the server every minute or so asking for new data regardless if any
exists or not. This could cause serious overloading of the server, whereas a
server push would only occur when new data exists.

Any ideas?

Thanks

James


-----Original Message-----
From: Corn Vollney-R7019C [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 20:15
To: 'James Duncan'; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM

James,

If you are the owner of the dowloaded html page you could use WDDX. Check it
out at WDDX.org.

Voll

-----Original Message-----
From: James Duncan [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 13, 2001 8:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM


Hi again,

Thanks for your help so far. I will explain what I'm trying to achieve. I
want to pull down a web page that contains share prices, extract those share
prices, and update a database with the new prices. What I want is a nice and
neat solution that runs like a service (i.e. I can stop and start it from a
web browser, change the update interval (how long it waits before it repeats
the process)), etc.

I know a little PHP and Javascript (what I've taught/learnt over the last
few weeks). The process I have so far (not implemented at all yet):

1) PHP script that pulls down the relevant web page to my server
2) Data extraction from HTML web page
3) Updating of database with data from step 2
4) Running step 1 again after a certain period of time

Step 2 is the most complex by far. I was hoping to use PHP to access the
#text value via DOM but obviously this isn't possible because the DOM
doesn't exist server-side but only after the HTML has been rendered
client-side. Like you say, I could create a form and hidden fields in the
HTML file and use Javascript to read the #text node values into the hidden
fields. Then trigger a POST operation, where I can read in all the values
but I don't like the sound of this because then I would have to have a
browser interacting with my PHP scripts!?! I'm trying to create a
self-contained "service" that doesn't have any external dependants.

Is there any other way of accomplishing this without involving a browser?
The only other way I can see is to use PHP to strip all HTML tags, leaving
just the text? I could then write PHP code to read in the remaining text,
etc.

What is the best way to accomplish this? Is there a PHP command that strips
all HTML tags (and Javascript, etc) from an HTML file? Example code would be
great ;)

Thanks

James


-----Original Message-----
From: Michael Stearne [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 18:40
To: James Duncan
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM

No, actually I think that using PHP to insert the FORM and then use
Javascript to get the #text node values would be easier.  Parsing Table
cells using RegExs is no fun.

Michael

On Saturday, January 13, 2001, at 01:06 PM, James Duncan wrote:

> But surely if I'm using fopen to insert a hidden form and fields I might
as
> well use fopen to extract the data from the HTML page in the first place?
It
> just seems so much easier to capture the #text node values from the DOM,
> rather than using fopen to locate the same information!?!
>
> Another idea would be to use my Javascript to capture the text node values
> from the DOM and write it to a cookie file. The contents of the cookie
file
> could then by read by PHP to populate the database?
>
> Thanks
>
> James
>
>
> -----Original Message-----
> From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> Sent: 13 January 2001 17:32
> To: James Duncan
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] DOM
>
>
> On Saturday, January 13, 2001, at 12:20 PM, James Duncan wrote:
>
> > I don't think this will work in my case because I don't control the
layout
> > of the HTML page and hence can't add the hidden fields. I'm downloading
> the
> > HTML pages from a website. It would require as much work to insert the
> > hidden fields as trying to strip the HTML tags in an attempt to read the
> > data directly from the HTML page itself. There must be a way to access
the
> > DOM directly from PHP? I notice in the manual there is a section
regarding
> > XML DOM but not the DOM itself.
> >
> > Are the DOM values only available on the client? If that's the case then
> PHP
> > can't be used to read them because it's limited to the server side?
>
> Well by the time you are talking about PHP is out of the picture.  PHP can
> be used to generate a DOM but once its generated PHP (or any server side
> language) is out of the picture, it then goes to the client-side stuff
like
> you said. You can use PHP's fopen() to grab the page and then add the form
> and hidden fields I was talking about.  By doing this, you are setting up
> the page to be handled correctly by the Javascript code you inserted
through
> PHP.
>
> Michael
>
> >
> > Thanks
> >
> > James
> >
> > -----Original Message-----
> > From: Michael Stearne [mailto:[EMAIL PROTECTED]]
> > Sent: 13 January 2001 17:06
> > To: James Duncan
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP-WIN] DOM
> >
> > Could you do something like:
> >
> >
>
myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first
> > Child.firstChild.node Value;
> >
> > Set up a form of hidden fields.  Extract the values from the DOM and
then
> > have the user hit a Submit button to get to the next page.  At that
point
> > the values that were collected and put into the hidden form fields will
be
> > submitted and you next page (the PHP page) could INSERT the values into
> the
> > database,
> >
> > Michael
> >
> >
> > On Friday, January 12, 2001, at 07:30 PM, 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]
>
>
>


--
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]





You don't understand the basic concept. 

DOM (Document Object Model) is a tree representing the structure 
of a document, where the elements (logically separated parts of) 
content is enclosed within tags to allow for computerized 
processing. IE exposes it's own version of DOM through its 
implementations of JS. If you want to access and manipulate a HTML 
document in PHP using this tree-like abstraction (DOM), you will 
have to use XML DOM library. No XML parser is an integral part of 
the language. 


At 18:20 13.1. 2001, James Duncan wrote the following:
-------------------------------------------------------------- 
>I don't think this will work in my case because I don't control the layout
>of the HTML page and hence can't add the hidden fields. I'm downloading the
>HTML pages from a website. It would require as much work to insert the
>hidden fields as trying to strip the HTML tags in an attempt to read the
>data directly from the HTML page itself. There must be a way to access the
>DOM directly from PHP? I notice in the manual there is a section regarding
>XML DOM but not the DOM itself.
>
>Are the DOM values only available on the client? If that's the case then PHP
>can't be used to read them because it's limited to the server side?
>
>Thanks
>
>James
>
>-----Original Message-----
>From: Michael Stearne [mailto:[EMAIL PROTECTED]]
>Sent: 13 January 2001 17:06
>To: James Duncan
>Cc: [EMAIL PROTECTED]
>Subject: Re: [PHP-WIN] DOM
>
>Could you do something like:
>
>myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].first
>Child.firstChild.node Value;
>
>Set up a form of hidden fields.  Extract the values from the DOM and then
>have the user hit a Submit button to get to the next page.  At that point
>the values that were collected and put into the hidden form fields will be
>submitted and you next page (the PHP page) could INSERT the values into the
>database,
>
>Michael
>
>
>On Friday, January 12, 2001, at 07:30 PM, 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]
------end of quote------ 



____________________________________________________________
Cynic:

A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.

[EMAIL PROTECTED]






Ah rite... thanks for the info. As I said I'm very new to all of this and
reading lots, whilst trying to make sense of it all ;) So it is possible to
use PHP to access DOM elements (via the XML DOM library) created from an
HTML source file (a code example would be very handy)? Does anyone know if
an XML parser will be built into PHP in the future? I then assume I could
access DOM elements from an HTML file in the same easy way as I can via
Javascript in IE?

Thanks

James


-----Original Message-----
From: Cynic [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2001 23:22
To: James Duncan; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] DOM

You don't understand the basic concept.

DOM (Document Object Model) is a tree representing the structure
of a document, where the elements (logically separated parts of)
content is enclosed within tags to allow for computerized
processing. IE exposes it's own version of DOM through its
implementations of JS. If you want to access and manipulate a HTML
document in PHP using this tree-like abstraction (DOM), you will
have to use XML DOM library. No XML parser is an integral part of
the language.


At 18:20 13.1. 2001, James Duncan wrote the following:
--------------------------------------------------------------
>I don't think this will work in my case because I don't control the layout
>of the HTML page and hence can't add the hidden fields. I'm downloading the
>HTML pages from a website. It would require as much work to insert the
>hidden fields as trying to strip the HTML tags in an attempt to read the
>data directly from the HTML page itself. There must be a way to access the
>DOM directly from PHP? I notice in the manual there is a section regarding
>XML DOM but not the DOM itself.
>
>Are the DOM values only available on the client? If that's the case then
PHP
>can't be used to read them because it's limited to the server side?
>
>Thanks
>
>James
>
>-----Original Message-----
>From: Michael Stearne [mailto:[EMAIL PROTECTED]]
>Sent: 13 January 2001 17:06
>To: James Duncan
>Cc: [EMAIL PROTECTED]
>Subject: Re: [PHP-WIN] DOM
>
>Could you do something like:
>
>myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].firs
t
>Child.firstChild.node Value;
>
>Set up a form of hidden fields.  Extract the values from the DOM and then
>have the user hit a Submit button to get to the next page.  At that point
>the values that were collected and put into the hidden form fields will be
>submitted and you next page (the PHP page) could INSERT the values into the
>database,
>
>Michael
>
>
>On Friday, January 12, 2001, at 07:30 PM, 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.nod
e
>> Name);
>>   alert("Value is: " +
>>
>tablejames.firstChild.childNodes[1].childNodes[5].firstChild.firstChild.nod
e
>> 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]
------end of quote------



____________________________________________________________
Cynic:

A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.

[EMAIL PROTECTED]





I should warn you that XML functions require the document to be 
very 'correct'. Most (I guess 98%... I wish browsers weren't so 
forgiving, all might've been much easier and better) of HTML 
pages on the internet basically aren't HTML (which is a son of 
SGML, and an older, heavily cripled brother of XML), and even 
strict HTML isn't XML compliant up to XHTML 1.0, which is the 
latest version of HTML, fully XML compliant. 
If you'll try to load such document into an XML parser, it'll 
die with an error message, because XML requires the document 
to be well-formed.

At 00:54 14.1. 2001, James Duncan wrote the following:
-------------------------------------------------------------- 
>Ah rite... thanks for the info. As I said I'm very new to all of this and
>reading lots, whilst trying to make sense of it all ;) So it is possible to
>use PHP to access DOM elements (via the XML DOM library) created from an
>HTML source file (a code example would be very handy)? Does anyone know if
>an XML parser will be built into PHP in the future? I then assume I could
>access DOM elements from an HTML file in the same easy way as I can via
>Javascript in IE?
>
>Thanks
>
>James
>
>
>-----Original Message-----
>From: Cynic [mailto:[EMAIL PROTECTED]]
>Sent: 13 January 2001 23:22
>To: James Duncan; [EMAIL PROTECTED]
>Cc: [EMAIL PROTECTED]
>Subject: RE: [PHP-WIN] DOM
>
>You don't understand the basic concept.
>
>DOM (Document Object Model) is a tree representing the structure
>of a document, where the elements (logically separated parts of)
>content is enclosed within tags to allow for computerized
>processing. IE exposes it's own version of DOM through its
>implementations of JS. If you want to access and manipulate a HTML
>document in PHP using this tree-like abstraction (DOM), you will
>have to use XML DOM library. No XML parser is an integral part of
>the language.
>
>
>At 18:20 13.1. 2001, James Duncan wrote the following:
>--------------------------------------------------------------
>>I don't think this will work in my case because I don't control the layout
>>of the HTML page and hence can't add the hidden fields. I'm downloading the
>>HTML pages from a website. It would require as much work to insert the
>>hidden fields as trying to strip the HTML tags in an attempt to read the
>>data directly from the HTML page itself. There must be a way to access the
>>DOM directly from PHP? I notice in the manual there is a section regarding
>>XML DOM but not the DOM itself.
>>
>>Are the DOM values only available on the client? If that's the case then
>PHP
>>can't be used to read them because it's limited to the server side?
>>
>>Thanks
>>
>>James
>>
>>-----Original Message-----
>>From: Michael Stearne [mailto:[EMAIL PROTECTED]]
>>Sent: 13 January 2001 17:06
>>To: James Duncan
>>Cc: [EMAIL PROTECTED]
>>Subject: Re: [PHP-WIN] DOM
>>
>>Could you do something like:
>>
>>myForm.myField.value=tablejames.firstChild.childNodes[1].childNodes[4].firs
>t
>>Child.firstChild.node Value;
>>
>>Set up a form of hidden fields.  Extract the values from the DOM and then
>>have the user hit a Submit button to get to the next page.  At that point
>>the values that were collected and put into the hidden form fields will be
>>submitted and you next page (the PHP page) could INSERT the values into the
>>database,
>>
>>Michael
>>
>>
>>On Friday, January 12, 2001, at 07:30 PM, 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.nod
>e
>>> Name);
>>>   alert("Value is: " +
>>>
>>tablejames.firstChild.childNodes[1].childNodes[5].firstChild.firstChild.nod
>e
>>> 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]
>------end of quote------
>
>
>
>____________________________________________________________
>Cynic:
>
>A member of a group of ancient Greek philosophers who taught
>that virtue constitutes happiness and that self control is
>the essential part of virtue.
>
>[EMAIL PROTECTED]
------end of quote------ 



____________________________________________________________
Cynic:

A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.

[EMAIL PROTECTED]






Hey all,

I am curious how one accounts for all possible quirks that may result from
textual form inputs when inserting or updating the results into the database.

For instance, if a form has <input type="text"> and/or <textarea> inputs,
how do you treat the results of those inputs to safely insert them into the
database, to correct for 'single quotes, "double quotes, \slashes, etc etc
etc.

I tried using urlencode, which fixed some things, but didn't fix the
problems resulting from the quotes.  I tried stripslashes, which didn't
seem to fix everything, either.

So, in other words, I have a form with some inputs, named perhaps text1 and
text2.
Then, when they submit the form, I want to insert or update that entry with
those values, like..
UPDATE tblStuff SET txtText1='".urlencode($text1)."',
txtText2='".urlencode($text2)."'";
or something like that..

Can anyone fill me in on what the proper string formatting function or
functions are to do this?

Thanks a lot!

-Mike Flynn





Hi all

        Ok I was able to get a file upload script to work on my Win2k, IIS5, PHP 4
server but now rather then me creating a page in the directory where the
people put their uploads I want to have a index page or similar that would
contain the upload script along with generate a directory structure of the
folders and files below it automatically. so I do not have to go through
once a day and update the index page to reflect the new files uploaded.  is
it possible to do this in PHP? If so could someone point me in the right
direction I am new to learning PHP thanks.

Clay



Reply via email to