php-general Digest 28 Nov 2008 16:19:40 -0000 Issue 5815

Topics (messages 283880 through 283905):

Re: [php] question about ob_end_flush
        283880 by: Robert Cummings

Re: array/iteration issue!!
        283881 by: Micah Gersten
        283882 by: bruce
        283883 by: Robert Cummings
        283884 by: bruce

Re: Curl with asp pages....
        283885 by: Andrew Ballard
        283891 by: Ashley Sheridan
        283899 by: ceo.l-i-e.com
        283900 by: ceo.l-i-e.com
        283901 by: Andrew Ballard
        283902 by: Andrew Ballard

Re: Netbeans 6.5 WAS: phpDesigner 2008?
        283886 by: Peter Ford

Re: Parsing XML
        283887 by: Per Jessen
        283890 by: Ashley Sheridan
        283894 by: Per Jessen
        283895 by: Ashley Sheridan
        283896 by: Nathan Rixham
        283897 by: Ashley Sheridan
        283903 by: Andrew Ballard

Re: How to Execute Multiple SQL Updates Using PHP
        283888 by: ANR Daemon

Re: fread() behaviour
        283889 by: ANR Daemon

Re: About Time Zones
        283892 by: Ashley Sheridan
        283893 by: Franz

Re: Happy Turkey Day
        283898 by: tedd

Re: file_Exists() and case
        283904 by: Lupus Michaelis

Trre/Drop Down quick app for testing database tbls
        283905 by: bruce

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]


----------------------------------------------------------------------
--- Begin Message ---
On Fri, 2008-11-28 at 12:01 +0800, jason liang wrote:
> Hi all
> 
> I am comfused about the function ob_end_flush.In the manual:This function
> will send the contents of the topmost output buffer (if any) and turn this
> output buffer off.
> 
> i have made such tests.
> 
> <?php
>     ob_start();
>     echo "hello word!";
>     ob_end_flush();
> ?>
> this works alright.the script output "hello world!".
> 
> <?php
>     ob_start();
>     echo "hello word!";
>     ob_end_flush();

Right here you said to end the current buffer... which means the active
output buffer becomes the next outer one.

>    ob_clean();

Here you've told the current buffer to purge. So you've essentially
wiped everything that was flushed from the previous inner buffer to the
current buffer. So you see nothing. Why is there an outer buffer? You
probably have output buffering enabled in your php.ini (see
output_buffering in php.ini).

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Thu, 2008-11-27 at 19:36 -0800, bruce wrote:
>   
>> hey robert!!
>>
>> thanks. and yeah, you're right, it's not the best.. so tell me, given that
>> i'm ripping through this on the fly, and i can have the structure in any way
>> i choose. this is just to simulate/populate some test tbls.. what's a better
>> way to create an array structure to have a collegename, followed by some
>> deptnames, followed by some classnames for the depts...
>>
>> perhaps something like this??
>>
>> $a = array
>> (
>>     "college" => "foo",
>>     array
>>     (
>>         "dept"  => "physics",
>>         "class" => array
>>         (
>>             "class1" => "sss",
>>             "class2" => "sffgg"
>>         )
>>     ),
>>     array
>>     (
>>         "dept"  => "english",
>>         "class" => array
>>         (
>>             "class1" => "sss",
>>             "class2" => "sffgg"
>>         )
>>     )
>> );
>>     
>
> Not quite. The following is probably what you want:
>
> <?php
>
> $colleges = array
> (
>     array
>     (
>         'name'  => 'Blah Blah University',
>         'depts' => array
>         (
>             array
>             (
>                 'name'    => 'physics',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>             array
>             (
>                 'name'    => 'english',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>         ),
>     ),
>     array
>     (
>         'name'  => 'Glah Gleh University',
>         'depts' => array
>         (
>             array
>             (
>                 'name'    => 'physics',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>             array
>             (
>                 'name'    => 'english',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>         ),
>     ),
> );
>
> foreach( $colleges as $college )
> {
>     $collegeName = $college['name'];
>     foreach( $college['depts'] as $dept )
>     {
>         $deptName = $dept['name'];
>         foreach( $dept['classes'] as $className )
>         {
>             echo "$collegeName, $deptName, $className\n";
>         }
>     }
> }
>
> ?>
>
> Cheers,
> Rob.
>   
This is actually a much smaller data structure.

$colleges = array
(
        'Blah Blah University' =>
        array
        (
            'physics' => array
                (
                    'sss',
                    'sffgg',
                ),
            'english' => array
                (
                    'sss',
                    'sffgg',
                )
        ),
        'Glah Gleh University' =>
        array
        (
            'physics' => array
                (
                    'sss',
                    'sffgg',
                ),
            'english' => array
                (
                    'sss',
                    'sffgg',
                ),
        )
 );


foreach( $colleges as $collegeName => $depts )
{
     foreach( $depts as $deptName => $classes)
    {
        foreach( $classes as $className )
        {
            echo "$collegeName, $deptName, $className\n";
        }
    }
}


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com





--- End Message ---
--- Begin Message ---
much props guys!!!

thanks!!


-----Original Message-----
From: Micah Gersten [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 27, 2008 8:23 PM
To: Robert Cummings
Cc: bruce; 'PHP General list'
Subject: Re: [PHP] array/iteration issue!!


Robert Cummings wrote:
> On Thu, 2008-11-27 at 19:36 -0800, bruce wrote:
>
>> hey robert!!
>>
>> thanks. and yeah, you're right, it's not the best.. so tell me, given
that
>> i'm ripping through this on the fly, and i can have the structure in any
way
>> i choose. this is just to simulate/populate some test tbls.. what's a
better
>> way to create an array structure to have a collegename, followed by some
>> deptnames, followed by some classnames for the depts...
>>
>> perhaps something like this??
>>
>> $a = array
>> (
>>     "college" => "foo",
>>     array
>>     (
>>         "dept"  => "physics",
>>         "class" => array
>>         (
>>             "class1" => "sss",
>>             "class2" => "sffgg"
>>         )
>>     ),
>>     array
>>     (
>>         "dept"  => "english",
>>         "class" => array
>>         (
>>             "class1" => "sss",
>>             "class2" => "sffgg"
>>         )
>>     )
>> );
>>
>
> Not quite. The following is probably what you want:
>
> <?php
>
> $colleges = array
> (
>     array
>     (
>         'name'  => 'Blah Blah University',
>         'depts' => array
>         (
>             array
>             (
>                 'name'    => 'physics',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>             array
>             (
>                 'name'    => 'english',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>         ),
>     ),
>     array
>     (
>         'name'  => 'Glah Gleh University',
>         'depts' => array
>         (
>             array
>             (
>                 'name'    => 'physics',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>             array
>             (
>                 'name'    => 'english',
>                 'classes' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             ),
>         ),
>     ),
> );
>
> foreach( $colleges as $college )
> {
>     $collegeName = $college['name'];
>     foreach( $college['depts'] as $dept )
>     {
>         $deptName = $dept['name'];
>         foreach( $dept['classes'] as $className )
>         {
>             echo "$collegeName, $deptName, $className\n";
>         }
>     }
> }
>
> ?>
>
> Cheers,
> Rob.
>
This is actually a much smaller data structure.

$colleges = array
(
        'Blah Blah University' =>
        array
        (
            'physics' => array
                (
                    'sss',
                    'sffgg',
                ),
            'english' => array
                (
                    'sss',
                    'sffgg',
                )
        ),
        'Glah Gleh University' =>
        array
        (
            'physics' => array
                (
                    'sss',
                    'sffgg',
                ),
            'english' => array
                (
                    'sss',
                    'sffgg',
                ),
        )
 );


foreach( $colleges as $collegeName => $depts )
{
     foreach( $depts as $deptName => $classes)
    {
        foreach( $classes as $className )
        {
            echo "$collegeName, $deptName, $className\n";
        }
    }
}


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
On Thu, 2008-11-27 at 22:22 -0600, Micah Gersten wrote:
>
> This is actually a much smaller data structure.
> 
> $colleges = array
> (
>       'Blah Blah University' =>
>         array
>         (
>             'physics' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             'english' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 )
>       ),
>       'Glah Gleh University' =>
>         array
>         (
>             'physics' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             'english' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>         )
>  );
> 
> 
> foreach( $colleges as $collegeName => $depts )
> {
>      foreach( $depts as $deptName => $classes)
>     {
>         foreach( $classes as $className )
>         {
>             echo "$collegeName, $deptName, $className\n";
>         }
>     }
> }

Yes, I thought of that one too, but it's less flexible. What if you need
to add other fields to the college, or department. Then you'd need to
redo the whole structure to something more similar to what I did. Since
bruce was having issues, I gave him a flexible format that could handle
other fields if they arose.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
both ways work...!!!

this is a really simple/quick issue to populate some test db tbls.. i've
only played with multi php arrays (sp??) in passing... and my days of being
a serious eng/software guy are long over!!

although.. with this economy!

thanks




-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 27, 2008 8:40 PM
To: Micah Gersten
Cc: bruce; 'PHP General list'
Subject: Re: [PHP] array/iteration issue!!


On Thu, 2008-11-27 at 22:22 -0600, Micah Gersten wrote:
>
> This is actually a much smaller data structure.
>
> $colleges = array
> (
>       'Blah Blah University' =>
>         array
>         (
>             'physics' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             'english' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 )
>       ),
>       'Glah Gleh University' =>
>         array
>         (
>             'physics' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             'english' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>         )
>  );
>
>
> foreach( $colleges as $collegeName => $depts )
> {
>      foreach( $depts as $deptName => $classes)
>     {
>         foreach( $classes as $className )
>         {
>             echo "$collegeName, $deptName, $className\n";
>         }
>     }
> }

Yes, I thought of that one too, but it's less flexible. What if you need
to add other fields to the college, or department. Then you'd need to
redo the whole structure to something more similar to what I did. Since
bruce was having issues, I gave him a flexible format that could handle
other fields if they arose.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
On Thu, Nov 27, 2008 at 7:12 PM, ioannes <[EMAIL PROTECTED]> wrote:
> What are the differences between asp and non-asp pages when you are curling
> them?  Apart from ,as referred to in php.net, you need to urlencode the post
> values...  Do you also need to urlencode the variable names?  And if the
> submit button on the page has javascript:WebForm_PostBackOptions, is that
> going to cause any complexity?  I have a working php curling script which
> works on many sites, but this asp page returns error from the server (Error
> Tracking Code: from server).  I have seen problems described on the internet
> with asp but apart from urlencode tip and that you need to submit the hidden
> VIEWSTATE etc variables, I have not seen any other tips.  I previously got
> just the input page, so getting the error is actually progress, which I got
> once I urlencoded the inputs, but clearly the inputs don't make sense to the
> script somehow and suspect there is some general differences between asp and
> non-asp pages for this purpose.
> John
>

It sounds like you're talking about ASP.NET rather than just ASP. (ASP
is simple enough that CURL usually shouldn't have any problems.)
ASP.NET added VIEWSTATE, which is a hidden form field that contains an
encoded value representing the entire form. It's a way for the server
to determine that the data posted matches the form that requested it,
as well as handling server-side actions that are triggered by
javascript that ASP.NET embeds in the form. It is very likely that you
will need to read the correct value of this field from the site prior
to sending your data.

There is a slight difference in how ASP handles multiple form fields
that share the same name (as well as SELECT MULTIPLE lists) such that
ASP does not need (and should not use) square brackets in field names
the way PHP does.

Andrew

--- End Message ---
--- Begin Message ---
On Fri, 2008-11-28 at 01:13 -0500, Andrew Ballard wrote:
> On Thu, Nov 27, 2008 at 7:12 PM, ioannes <[EMAIL PROTECTED]> wrote:
> > What are the differences between asp and non-asp pages when you are curling
> > them?  Apart from ,as referred to in php.net, you need to urlencode the post
> > values...  Do you also need to urlencode the variable names?  And if the
> > submit button on the page has javascript:WebForm_PostBackOptions, is that
> > going to cause any complexity?  I have a working php curling script which
> > works on many sites, but this asp page returns error from the server (Error
> > Tracking Code: from server).  I have seen problems described on the internet
> > with asp but apart from urlencode tip and that you need to submit the hidden
> > VIEWSTATE etc variables, I have not seen any other tips.  I previously got
> > just the input page, so getting the error is actually progress, which I got
> > once I urlencoded the inputs, but clearly the inputs don't make sense to the
> > script somehow and suspect there is some general differences between asp and
> > non-asp pages for this purpose.
> > John
> >
> 
> It sounds like you're talking about ASP.NET rather than just ASP. (ASP
> is simple enough that CURL usually shouldn't have any problems.)
> ASP.NET added VIEWSTATE, which is a hidden form field that contains an
> encoded value representing the entire form. It's a way for the server
> to determine that the data posted matches the form that requested it,
> as well as handling server-side actions that are triggered by
> javascript that ASP.NET embeds in the form. It is very likely that you
> will need to read the correct value of this field from the site prior
> to sending your data.
> 
> There is a slight difference in how ASP handles multiple form fields
> that share the same name (as well as SELECT MULTIPLE lists) such that
> ASP does not need (and should not use) square brackets in field names
> the way PHP does.
> 
> Andrew
> 
I thought that square brackets were actually part of the HTML spec, not
PHP, so the fact that ASP.Net cannot use them is just another example of
M$ doing their own thing again...


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
The one thing that's always tripped me up with ASP sites is that you have to 
add EVERY input, even the type="submit" with the correct value from the one and 
only submit button on the page.



Not sure what the ASP code monkeys are doing with their point-and-click UI, but 
I presume it's just a boilerplate operation that needs the submit input just in 
case they add a second button some day.



The variable names shouldn't need URLencoding in any proper webapp, but try it 
and see.



So check the form (and any JS) carefully to be sure you are not missing some 
INPUT element in your POST data.



Use Firefox LiveHTTPHeaders to see what goes back-n-forth on a real working 
exchange as well.



ASP developers tend to do a LOT of needless header("Location: ") bouncing with 
added/changed cookies as well, so you have to track all of that.



--- End Message ---
--- Begin Message ---
> There is a slight difference in how ASP handles multiple form fields

> that share the same name (as well as SELECT MULTIPLE lists) such that

> ASP does not need (and should not use) square brackets in field names

> the way PHP does.



Alas, not only doesn't it need them, it CANNOT use them, so you are stuck if 
you want to do something such as:



name="foo[1]" value="17"

name="foo[5]" value="47"

name="foo[17]" value="32"



I was quite disappointed when I found out that ASP simply could not maintain a 
simple key-value pairing without jumping through hoops...



It made for a whole 'nother verse in my "Microsoft Sucks" song strewn 
throughout the code comments of that ASP project.



Another verse was "Boolean expressions don't short-circuit"

:-)



Ah, and "Can't moveFirst in an empty record set" was another.



Sadly, the song is lost as I failed to make a copy of that codebase before I 
moved on to another task.



--- End Message ---
--- Begin Message ---
On Fri, Nov 28, 2008 at 9:59 AM,  <[EMAIL PROTECTED]> wrote:
>
> The one thing that's always tripped me up with ASP sites is that you have to 
> add EVERY input, even the type="submit" with the correct value from the one 
> and only submit button on the page.

Again, I think that's the ASP.NET part.
>
> Not sure what the ASP code monkeys are doing with their point-and-click UI, 
> but I presume it's just a boilerplate operation that needs the submit input 
> just in case they add a second button some day.

I've had the same problem with Zend_Form, honestly.


> The variable names shouldn't need URLencoding in any proper webapp, but try 
> it and see.

Well, they either need to contain valid URL characters or they need to
be encoded. If you have a variable name that contains an equal sign
(crazy, but can be technically valid since names are just strings --
to me it seems little less crazy than including square brackets in a
variable name in HTML) it will have to be escaped.

> Use Firefox LiveHTTPHeaders to see what goes back-n-forth on a real working 
> exchange as well.

I agree. It's definitely a lifesaver. FWIW, there is a similar tool
for IE too, if you ever find yourself stuck for one of those lovely
cases where the site works fine in Firefox but not in IE.

Andrew

--- End Message ---
--- Begin Message ---
On Fri, Nov 28, 2008 at 10:08 AM,  <[EMAIL PROTECTED]> wrote:
>
>> There is a slight difference in how ASP handles multiple form fields
>> that share the same name (as well as SELECT MULTIPLE lists) such that
>> ASP does not need (and should not use) square brackets in field names
>> the way PHP does.
>
> Alas, not only doesn't it need them, it CANNOT use them, so you are stuck if 
> you want to do something such as:
>
> name="foo[1]" value="17"
> name="foo[5]" value="47"
> name="foo[17]" value="32"
>
> I was quite disappointed when I found out that ASP simply could not maintain 
> a simple key-value pairing without jumping through hoops...

Having worked in PHP long enough to realize the value of what you are
talking about, I can see a use for it. It still seems odd to me,
though. :-)

> It made for a whole 'nother verse in my "Microsoft Sucks" song strewn 
> throughout the code comments of that ASP project.

LOL

> Another verse was "Boolean expressions don't short-circuit"
> :-)

Yeah, that got me for a while when I first started working in ASP
after PHP and JavaScript. What a pain.


> Ah, and "Can't moveFirst in an empty record set" was another.

Well, I got used to checking for EOF and/or BOF before trying to move
around. Once I got used to it, I didn't find it that big of a deal.
For those accustomed to PHP, there are a couple methods on the
recordset object that will make things more familiar. One implodes the
recordset with cell and row delimiters that are useful for packing the
data into a CSV (providing that a value doesn't have commas or double
quotes that need escaped); the other turns the recordset into a
multi-dimensional array. As I recall, though, the indexes are
"reversed".

> Sadly, the song is lost as I failed to make a copy of that codebase before I 
> moved on to another task.

Sadly? Are you really pining for it? :-)

Andrew

--- End Message ---
--- Begin Message ---
Bastien Koert wrote:
> On Wed, Nov 26, 2008 at 7:34 PM, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> 
>>  On Tue, 2008-11-18 at 10:32 +0000, Holografix wrote:
>>
>> Hi
>> I tried PHPDesigner some time ago. It's not bad but now I'm using Netbeans
>> and it's a good editor: http://www.netbeans.org/ (it's free!)
>>
>>  I watched the little movie demo and was impressed, so I just installed and
>> tried the Netbeans 6.5 (.sh installer for Linux b/c the Ubuntu repository
>> has 6.1 still) and am really disappointed at how pokey the GUI is?! It's so
>> slow as to be unusable. I'm baffled by this, as I've been using Eclipse PDT
>> (which is a pig) and that also uses Java, but it's nowhere near as slow as
>> Netbeans is.
>>
>> My system is far from old:
>>
>> Intel P4 CPU 3.20GHz with 2GB RAM.
>>
>> java version "1.6.0_10"
>> Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
>> Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
>>
>> (also tried with the OpenJDK or whatever it's called, and had the same
>> miserable experience)
>>
>> I tried to adjust some of the netbeans.conf that I saw in the FAQ to no
>> avail:
>>
>> netbeans_default_options="-J-client -J-Xverify:none -J-Xmx256m -J-Xss2m
>> -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m
>> -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true
>> -J-XX:CompileThreshold=100 -Dswing.aatext=true"
>>
>> The fonts also looked horrible! All pixeley and like I was back in the
>> 1980's.
>>
>> I read the forums and searched for "slow" and saw other poor souls with
>> similar experiences, but no solutions. [image: :(]
>>
>> Oh well... Guess I'll stick with Eclipse PDT (and how does Zend get off
>> charging $400 for "Zend Studio" which amounts to a few Eclipse plugins?!?
>> Seriously? That's $150 at best)
>>
>> Daevid.
>> http://www.daevid.com <http://daevid.com>
>>
>>
> I've installed it but have yet to use it. I am having a good time with
> APTANA Studio, though there is a learning curve
> 

As a long-time Java developer, I am pretty familiar with NetBeans, so I'm loving
  6.5 for PHP. It's the best debugging environment I've found (I could never get
Quanta+ to do debugging in any sane way...)
I certainly don't find it slow (not like Eclipse was) or confusing (again,
looking at you, Eclipse), and on my SuSE Linux box (Intel CoreD 2.4Ghz, 2Gb RAM)
the fonts are lovely and smooth.

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:

> Do any of you have a copy of this extension, or failing that, a
> suggestion of how I can parse XML files without having to install
> anything on the remote server, as I do not have that level off access
> to it.

Parsing XML is best done with XSL - if that's out of the question,
you're in for a difficult time. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
On Fri, 2008-11-28 at 10:15 +0100, Per Jessen wrote:
> Ashley Sheridan wrote:
> 
> > Do any of you have a copy of this extension, or failing that, a
> > suggestion of how I can parse XML files without having to install
> > anything on the remote server, as I do not have that level off access
> > to it.
> 
> Parsing XML is best done with XSL - if that's out of the question,
> you're in for a difficult time. 
> 
> 
> /Per Jessen, Zürich
> 
> 
XSL will only allow me to convert it into a different document format,
which is not what I want as I need to keep a local copy of information
in a database for searching and sorting purposes. Nathans class allows
me to have the entire document put into an array tree, which is fine for
what I need so far.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:

> On Fri, 2008-11-28 at 10:15 +0100, Per Jessen wrote:
>> Ashley Sheridan wrote:
>> 
>> > Do any of you have a copy of this extension, or failing that, a
>> > suggestion of how I can parse XML files without having to install
>> > anything on the remote server, as I do not have that level off
>> > access to it.
>> 
>> Parsing XML is best done with XSL - if that's out of the question,
>> you're in for a difficult time.
>> 
>> 
>> /Per Jessen, Zürich
>> 
>> 
> XSL will only allow me to convert it into a different document format,
> which is not what I want as I need to keep a local copy of information
> in a database for searching and sorting purposes. Nathans class allows
> me to have the entire document put into an array tree, which is fine
> for what I need so far.

That's cool, but XSL is still the more appropriate tool IMO.  It does
exactly what you need - it parses and validates the XML document,
allows you to extract the bits you need and in virtually any format you
need - which could be a text document with SQL statements for piping to
mysql. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
On Fri, 2008-11-28 at 13:14 +0100, Per Jessen wrote:
> Ashley Sheridan wrote:
> 
> > On Fri, 2008-11-28 at 10:15 +0100, Per Jessen wrote:
> >> Ashley Sheridan wrote:
> >> 
> >> > Do any of you have a copy of this extension, or failing that, a
> >> > suggestion of how I can parse XML files without having to install
> >> > anything on the remote server, as I do not have that level off
> >> > access to it.
> >> 
> >> Parsing XML is best done with XSL - if that's out of the question,
> >> you're in for a difficult time.
> >> 
> >> 
> >> /Per Jessen, Zürich
> >> 
> >> 
> > XSL will only allow me to convert it into a different document format,
> > which is not what I want as I need to keep a local copy of information
> > in a database for searching and sorting purposes. Nathans class allows
> > me to have the entire document put into an array tree, which is fine
> > for what I need so far.
> 
> That's cool, but XSL is still the more appropriate tool IMO.  It does
> exactly what you need - it parses and validates the XML document,
> allows you to extract the bits you need and in virtually any format you
> need - which could be a text document with SQL statements for piping to
> mysql. 
> 
> 
> /Per Jessen, Zürich
> 
> 
Possibly, but I wouldn't want to trust the end content in such a way;
I'd like to check out the values first. All-in-all, I think XSL is not
the right tool for the job in this case, but it is A way of doing it. 


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
2008/11/27 Ashley Sheridan <[EMAIL PROTECTED]>

> On Thu, 2008-11-27 at 22:13 +0000, Ashley Sheridan wrote:
> > On Thu, 2008-11-27 at 20:56 +0000, Nathan Rixham wrote:
> > > Ashley Sheridan wrote:
> > > > Hi All,
> > > >
> > > > I've run into a bit of a problem. I need to parse some fairly
> detailed
> > > > XML files from a remote website. I'm pulling in the remote XML using
> > > > curl, and that bit is working fine. The smaller XML documents were
> easy
> > > > to parse with regular expressions, as I only needed  bit of
> information
> > > > out of them.
> > > >
> > > > The live server I'm eventually putting this onto only has domxml for
> > > > working with XML. I've been trying to find the pecl extension for
> this
> > > > to install on my local machine, but the pecl.php.net site is a bit
> > > > nerfed for this extension (I'm getting a file not found error
> message.)
> > > >
> > > > Do any of you have a copy of this extension, or failing that, a
> > > > suggestion of how I can parse XML files without having to install
> > > > anything on the remote server, as I do not have that level off access
> to
> > > > it.
> > > >
> > > > Thanks
> > > > Ash
> > > > www.ashleysheridan.co.uk
> > > >
> > >
> > > standard response which has helped a few recently :p
> > >
> > > "you could give this a go if you like (one i made earlier):
> > > http://programphp.com/xmlparser.phps - class at the top, usage at the
> > > bottom."
> > >
> > I've started using DOMDocument for this (I bypassed your code for the
> > moment as it uses regular expressions, which were a speed bottleneck
> > with my approach) but I can't find any proper documentation on it
> > online. My efforts so far have resulted in a lot of errors which are
> > nigh on impossible to debug. I've used the dom class in javascript
> > without problems now, and it seems to look similar, but it's all going
> > wrong!
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> OK, given up on DOMDocument, and tried your code Nathan, works
> beautifully! Turns out the slow speeds I was experiencing before using
> the regexes was down to the remote server serving out the xml document.
> Its the armory server on wow-europe, so not too worried about that!
>
>
> Ash
> www.ashleysheridan.co.uk
>
> glad to be of service; if you can use DOMDocument I've got a whole fleet of
xml parsers written up using it, and auto xml to object convertors etc etc -
or there's a commercial version available I made some time ago aswell
http://rssphp.net/ v3
but just ask me got ones better since :)

--- End Message ---
--- Begin Message ---
On Fri, 2008-11-28 at 13:48 +0000, Nathan Rixham wrote:
> 2008/11/27 Ashley Sheridan <[EMAIL PROTECTED]>
>         
>         On Thu, 2008-11-27 at 22:13 +0000, Ashley Sheridan wrote:
>         > On Thu, 2008-11-27 at 20:56 +0000, Nathan Rixham wrote:
>         > > Ashley Sheridan wrote:
>         > > > Hi All,
>         > > >
>         > > > I've run into a bit of a problem. I need to parse some
>         fairly detailed
>         > > > XML files from a remote website. I'm pulling in the
>         remote XML using
>         > > > curl, and that bit is working fine. The smaller XML
>         documents were easy
>         > > > to parse with regular expressions, as I only needed  bit
>         of information
>         > > > out of them.
>         > > >
>         > > > The live server I'm eventually putting this onto only
>         has domxml for
>         > > > working with XML. I've been trying to find the pecl
>         extension for this
>         > > > to install on my local machine, but the pecl.php.net
>         site is a bit
>         > > > nerfed for this extension (I'm getting a file not found
>         error message.)
>         > > >
>         > > > Do any of you have a copy of this extension, or failing
>         that, a
>         > > > suggestion of how I can parse XML files without having
>         to install
>         > > > anything on the remote server, as I do not have that
>         level off access to
>         > > > it.
>         > > >
>         > > > Thanks
>         > > > Ash
>         > > > www.ashleysheridan.co.uk
>         > > >
>         > >
>         > > standard response which has helped a few recently :p
>         > >
>         > > "you could give this a go if you like (one i made
>         earlier):
>         > > http://programphp.com/xmlparser.phps - class at the top,
>         usage at the
>         > > bottom."
>         > >
>         > I've started using DOMDocument for this (I bypassed your
>         code for the
>         > moment as it uses regular expressions, which were a speed
>         bottleneck
>         > with my approach) but I can't find any proper documentation
>         on it
>         > online. My efforts so far have resulted in a lot of errors
>         which are
>         > nigh on impossible to debug. I've used the dom class in
>         javascript
>         > without problems now, and it seems to look similar, but it's
>         all going
>         > wrong!
>         >
>         >
>         > Ash
>         > www.ashleysheridan.co.uk
>         >
>         >
>         
>         OK, given up on DOMDocument, and tried your code Nathan, works
>         beautifully! Turns out the slow speeds I was experiencing
>         before using
>         the regexes was down to the remote server serving out the xml
>         document.
>         Its the armory server on wow-europe, so not too worried about
>         that!
>         
>         
>         
>         Ash
>         www.ashleysheridan.co.uk
>         
>         
> glad to be of service; if you can use DOMDocument I've got a whole
> fleet of xml parsers written up using it, and auto xml to object
> convertors etc etc - or there's a commercial version available I made
> some time ago aswell http://rssphp.net/ v3
> but just ask me got ones better since :)

Thanks, if I run into any problems with this, I might look at that.
You've been a great help!


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Fri, Nov 28, 2008 at 5:45 AM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Fri, 2008-11-28 at 10:15 +0100, Per Jessen wrote:
>> Ashley Sheridan wrote:
>>
>> > Do any of you have a copy of this extension, or failing that, a
>> > suggestion of how I can parse XML files without having to install
>> > anything on the remote server, as I do not have that level off access
>> > to it.
>>
>> Parsing XML is best done with XSL - if that's out of the question,
>> you're in for a difficult time.
>>
>>
>> /Per Jessen, Zürich
>>
>>
> XSL will only allow me to convert it into a different document format,
> which is not what I want as I need to keep a local copy of information
> in a database for searching and sorting purposes. Nathans class allows
> me to have the entire document put into an array tree, which is fine for
> what I need so far.
>
>
> Ash
> www.ashleysheridan.co.uk

A bit over the top, but you could always use XSL to turn it into CSV.   LOL

Andrew

--- End Message ---
--- Begin Message ---
Greetings, Nathan Rixham.
In reply to Your message dated Wednesday, November 19, 2008, 23:53:46,

> just my two pennies, unless you've got a good reason to do it all in one
> or some decent performance gain by doign so, leave it out and have the 
> front end functionality as per the clients requirements.

Well, as last resort, there's a transactions exists.
Especially for these times where you DO need to insert/update more than one
row at once, without even smalest possibility of intervention from other
clients.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


--- End Message ---
--- Begin Message ---
Greetings, Jochem Maas.
In reply to Your message dated Thursday, November 20, 2008, 22:11:09,

> good stuff from Stut & Craige ... I just wondered, Im pretty sure that the
> usleep(1000) is completely superfluous. fread() will read to the buffer length
> or EOF regardless of how slow the stream trickles in (obviously it may timeout
> if nothing trickles in for ages but that's a different issue and not solved
> with a usleep() AFAICT).

Keep in mind that PHP has configuration limit for maximum execution time of
single command.
If you sure know that your socket could be slow, you'd better use functions
designed especially to work with asyncronous I/O.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


--- End Message ---
--- Begin Message ---
On Fri, 2008-11-28 at 02:23 +0100, Franz wrote:
> Hi,
> 
> I do not know if I am at the right place...
> 
> Ref. : http://fr3.php.net/manual/fr/timezones.america.php
> 
> Well I was wondering what is the different between :
> 
> - America/Argentina/Buenos_Aires
> 
> and
> 
> - America/Buenos_Aires
> 
> Thank you
> 
Maybe one group uses the daylight savings part of the year, i.e. if
Argentina used it and America and Buenos Aires didn't, thenyou'd have to
have two timezones set up to allow for that.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Thank you very much Ash to take time to answer my question !

Of course I kept on searching for the answer... And of course, you are right. In fact in 2004 several provinces of Argentina switched for some time to another time zone and observed in effect DST (source : http://home-4.tiscali.nl/~t876506/Multizones.html#ar).

As I am working on an international project I must manage timezones.

Have a nice day Ash !

Franz
(personal website : http://www.pelloud.com)

--- End Message ---
--- Begin Message ---
At 5:26 PM +0000 11/27/08, Ashley Sheridan wrote:
For anyone who has no idea who Mr Bean is:


I've always liked Mr Bean -- there's a bit of him in all of us.

However, I saw a performance done by him about Americans that was a bit over-the-top. The skit centered on how fat Americans were.

I am sure if he ran that skit in a trailer for one of his movies in the States, the attendance for his movie would drop -- a bit like biting the fat-hand that feeds him.

In any event, I enjoy his performances.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Stan a écrit :
The script is running on an UBUNTU v8.04 LAMP server.  Case is supposed to
matter, isn't it?

With a POSIX filesystem only. If you store you're pictures in a fat or ntfs filesystem, case sensitive will not matter. BTW, extension concept doesn't exists in POSIX filesystems, because it is unsafe.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
Hi.

I've got a few tbls that I'm testing. I'd like to have a simple web app to
be able to iterate through the tbls to test out what I have in them.

I'd like to be able to have each tbl as a drop-down/select box, so I select
from selecta, which lists items from TBL-A, which then uses the id from
TBL-A, to get the items from TBL-B that matches. Selecting from drop-down
for TBL-B, then gets me the list on TBL-C...

I've got 3-4 tbls that are linked by their id.

Rather than reinvent the wheel, I'm asking if anyone has a quick app that
they can point to that I can extract/modify the functionality for my
needs...

thanks


--- End Message ---

Reply via email to