php-general Digest 6 Oct 2005 09:24:17 -0000 Issue 3722

Topics (messages 223665 through 223687):

Re: Scripts not working outside of Zend Studio
        223665 by: Greg Donald
        223666 by: Steve Harp

PHP and XML
        223667 by: php.swimwebs.com
        223675 by: Stephen Leaf
        223676 by: php.swimwebs.com
        223679 by: Stephen Leaf

form not submitting when I change action from PHP_SELF to thanks page
        223668 by: Bruce Gilbert
        223669 by: Robert Cummings
        223670 by: Bruce Gilbert
        223674 by: Robert Cummings

Re: caching parsed XML files as DOM objects in memory
        223671 by: Daevid Vincent
        223673 by: Jasper Bryant-Greene
        223680 by: Petr Smith
        223686 by: Petr Smith

PHP5 OOP how do I get the list of all classes dynamically?
        223672 by: Daevid Vincent
        223677 by: Oliver Grätz

mail() with port & authentication
        223678 by: Brian Dunning
        223687 by: Mark Rees

Detect file size BEFORE upload it
        223681 by: Ruben
        223682 by: Jasper Bryant-Greene
        223683 by: Ruben

Re: caching parsed XML files... FALSE advice, still not working
        223684 by: Petr Smith
        223685 by: Jasper Bryant-Greene

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 10/5/05, Steve Harp <[EMAIL PROTECTED]> wrote:
> I've got  the php.ini set to throw errors:
> error_reporting  =  E_ALL & E_NOTICE & E_STRICT
> display_errors = On

But which php.ini on your system is your web server using?  Many newer
Linux distros for example ship with multiple php.ini files, one for
the cli PHP, one for the mod_php.

I'd cut out the middle man and add a call to error_reporting() at the
top of the script.


--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

--- End Message ---
--- Begin Message ---
On Wed, 5 Oct 2005 16:25:03 -0500, [EMAIL PROTECTED] (Greg Donald)
wrote:

>error_reporting(

Well that now gives me errors.  Thanks very much...

--- End Message ---
--- Begin Message ---
My company recently installed google's search appliance and I am working
on some scripts to display the search results on our various websites. 
The problem I'm having is using the XML parsing functions I've used on
other pages is not working because the returned XML has invalid xml
characters in it.  For example, the data between the xml tags include
html tags that are supposed to be displayed.  But when I parse the xml,
the parse sees these tags as new start tags.  Is there a way to work
around this or a different way to parse this document?  I've heard a
little about XSLT really don't know anything about it and am wondering
if that is the way to deal with it?

Here is a part of the XML returned by the google appliance:
<GSP VER="3.2">
<TM>0.008398</TM>
<Q>information services</Q>
<PARAM name="q" value="information services"
original_value="information+services"/>
<PARAM name="site" value="shpolicy" original_value="shpolicy"/>
<PARAM name="client" value="shpolicy" original_value="shpolicy"/>
<PARAM name="output" value="xml_no_dtd" original_value="xml_no_dtd"/>
<PARAM name="btnG" value="Google_Search"
original_value="Google+Search"/>
<PARAM name="ip" value="10.2.4.44" original_value="10.2.4.44"/>
<PARAM name="access" value="p" original_value="p"/>
-
        <RES SN="1" EN="10">
<M>86</M>
<FI/>
-
        <NB>
-
        <NU>
/search?q=information+services&site=shpolicy&hl=en&output=xml_no_dtd&client=shpolicy&access=p&sort=date:D:L:d1&start=10&sa=N
</NU>
</NB>
-
        <R N="1" MIME="application/pdf">
-
        <U>
http://shpolicy.shservices.org/administrative/InformationServices/housewideapplicable/Information%20Services%20Software%20Purchasing%20Policy.pdf
</U>
-
        <UE>
http://shpolicy.shservices.org/administrative/InformationServices/housewideapplicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.pdf
</UE>
-
        <T>
<b>Information</b> <b>Services</b> Software Purchasing
</T>
<RK>5</RK>
<FS NAME="date" VALUE="2005-09-07"/>
-
        <S>
 <b>...</b> Administrative Housewide Policy <b>Information</b>
<b>Services</b> Software Purchasing Applicable<br> Campus: Salem and
West Valley Hospitals Department Name: <b>Information</b> <b>...</b>  
</S>
-
        <HAS>
<L/>
<C SZ="" CID="4_wracnOVC8:"/>
</HAS>
</R>

I can send the parsing code but it's fairly straight forward and I
didn't want to needlessly fill up the email.

Any suggestions?

Thanks,
Robbert van Andel

--- End Message ---
--- Begin Message ---
On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote:
> My company recently installed google's search appliance and I am working
> on some scripts to display the search results on our various websites.
> The problem I'm having is using the XML parsing functions I've used on
> other pages is not working because the returned XML has invalid xml
> characters in it.  For example, the data between the xml tags include
> html tags that are supposed to be displayed.  But when I parse the xml,
> the parse sees these tags as new start tags.  Is there a way to work
> around this or a different way to parse this document?  I've heard a
> little about XSLT really don't know anything about it and am wondering
> if that is the way to deal with it?
XSL can display the contents using a 
<xsl:copy-of select="node"/>
bear in mind tho that it also copies the node name.
example:
<node>copied stuff<br/></node>

copying only the inner content can be achieved by doing a select="." however 
you'll need to have the current node be the one that you want copied.
this can be done by using a
<xsl:for-each select="node">
<xsl:copy-of select="."/>
</xsl:for-each>

If anyone else knows of a better way _please_ let me know :)

When working with XML and going to HTML .. IMO XSL is the best way to 
accomplish it.

>
> Here is a part of the XML returned by the google appliance:
> <GSP VER="3.2">
> <TM>0.008398</TM>
> <Q>information services</Q>
> <PARAM name="q" value="information services"
> original_value="information+services"/>
> <PARAM name="site" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="client" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="output" value="xml_no_dtd" original_value="xml_no_dtd"/>
> <PARAM name="btnG" value="Google_Search"
> original_value="Google+Search"/>
> <PARAM name="ip" value="10.2.4.44" original_value="10.2.4.44"/>
> <PARAM name="access" value="p" original_value="p"/>
> -
>       <RES SN="1" EN="10">
> <M>86</M>
> <FI/>
> -
>       <NB>
> -
>       <NU>
> /search?q=information+services&site=shpolicy&hl=en&output=xml_no_dtd&client
>=shpolicy&access=p&sort=date:D:L:d1&start=10&sa=N </NU>
> </NB>
> -
>       <R N="1" MIME="application/pdf">
> -
>       <U>
> http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf </U>
> -
>       <UE>
> http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.p
>df </UE>
> -
>       <T>
> <b>Information</b> <b>Services</b> Software Purchasing
> </T>
> <RK>5</RK>
> <FS NAME="date" VALUE="2005-09-07"/>
> -
>       <S>
>  <b>...</b> Administrative Housewide Policy <b>Information</b>
> <b>Services</b> Software Purchasing Applicable<br> Campus: Salem and
> West Valley Hospitals Department Name: <b>Information</b> <b>...</b>
> </S>
> -
>       <HAS>
> <L/>
> <C SZ="" CID="4_wracnOVC8:"/>
> </HAS>
> </R>
>
> I can send the parsing code but it's fairly straight forward and I
> didn't want to needlessly fill up the email.
>
> Any suggestions?
>
> Thanks,
> Robbert van Andel

--- End Message ---
--- Begin Message ---
Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM based
installation of PHP version 5.0.4.  I see on PHP.net's website that XSL
comes standard with PHP 5 and you need to enable it by adding the argument
--with-xsl to the configure line.  How do I do this when we did not build
PHP from source?  Is there another way to get XSL activated?

Thanks for your help
Robbert 

-----Original Message-----
From: Stephen Leaf [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 05, 2005 7:39 PM
To: [email protected]
Subject: Re: [PHP] PHP and XML

On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote:
> My company recently installed google's search appliance and I am working
> on some scripts to display the search results on our various websites.
> The problem I'm having is using the XML parsing functions I've used on
> other pages is not working because the returned XML has invalid xml
> characters in it.  For example, the data between the xml tags include
> html tags that are supposed to be displayed.  But when I parse the xml,
> the parse sees these tags as new start tags.  Is there a way to work
> around this or a different way to parse this document?  I've heard a
> little about XSLT really don't know anything about it and am wondering
> if that is the way to deal with it?
XSL can display the contents using a 
<xsl:copy-of select="node"/>
bear in mind tho that it also copies the node name.
example:
<node>copied stuff<br/></node>

copying only the inner content can be achieved by doing a select="." however

you'll need to have the current node be the one that you want copied.
this can be done by using a
<xsl:for-each select="node">
<xsl:copy-of select="."/>
</xsl:for-each>

If anyone else knows of a better way _please_ let me know :)

When working with XML and going to HTML .. IMO XSL is the best way to 
accomplish it.

>
> Here is a part of the XML returned by the google appliance:
> <GSP VER="3.2">
> <TM>0.008398</TM>
> <Q>information services</Q>
> <PARAM name="q" value="information services"
> original_value="information+services"/>
> <PARAM name="site" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="client" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="output" value="xml_no_dtd" original_value="xml_no_dtd"/>
> <PARAM name="btnG" value="Google_Search"
> original_value="Google+Search"/>
> <PARAM name="ip" value="10.2.4.44" original_value="10.2.4.44"/>
> <PARAM name="access" value="p" original_value="p"/>
> -
>       <RES SN="1" EN="10">
> <M>86</M>
> <FI/>
> -
>       <NB>
> -
>       <NU>
>
/search?q=information+services&site=shpolicy&hl=en&output=xml_no_dtd&client
>=shpolicy&access=p&sort=date:D:L:d1&start=10&sa=N </NU>
> </NB>
> -
>       <R N="1" MIME="application/pdf">
> -
>       <U>
>
http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf </U>
> -
>       <UE>
>
http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.
p
>df </UE>
> -
>       <T>
> <b>Information</b> <b>Services</b> Software Purchasing
> </T>
> <RK>5</RK>
> <FS NAME="date" VALUE="2005-09-07"/>
> -
>       <S>
>  <b>...</b> Administrative Housewide Policy <b>Information</b>
> <b>Services</b> Software Purchasing Applicable<br> Campus: Salem and
> West Valley Hospitals Department Name: <b>Information</b> <b>...</b>
> </S>
> -
>       <HAS>
> <L/>
> <C SZ="" CID="4_wracnOVC8:"/>
> </HAS>
> </R>
>
> I can send the parsing code but it's fairly straight forward and I
> didn't want to needlessly fill up the email.
>
> Any suggestions?
>
> Thanks,
> Robbert van Andel

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

--- End Message ---
--- Begin Message ---
On Wednesday 05 October 2005 09:46 pm, Robbert van Andel wrote:
> Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM
> based installation of PHP version 5.0.4.  I see on PHP.net's website that
> XSL comes standard with PHP 5 and you need to enable it by adding the
> argument --with-xsl to the configure line.  How do I do this when we did
> not build PHP from source?  Is there another way to get XSL activated?

Compiling it from source will be your best choice.
If you have a test server compile it there and create the rpm. then install on 
the production server.

--- End Message ---
--- Begin Message ---
I have a form that submits and returns on the same page and works fine.

I know want to change the submission action from   {$_SERVER['PHP_SELF']}

to an external thanks page so the form method would change to:
<form action="thanks.php" method="POST">


now I need to know what else I have to change in the form below to
change to get the thanks page to submit the info. other than the
obvius which is to get rid of the echo thank-you msg. at the end of
the form.

Here is the current code:

    <?php
$form_block=<<<END_FORM
<form method="post" action="{$_SERVER['PHP_SELF']}" class="info_request" >
<fieldset class="left">
<legend title="About You">About You</legend>

<p><label for="firstname"><span class="red">*</span> First Name: </label><br />

<input id="firstname" name="firstname" type="text"
value="{$_POST['firstname']}" /></p>

<p><label for="lastname"><span class="red">*</span> Last Name:</label><br />

<input id="lastname" name="lastname" type="text"
value="{$_POST['lastname']}" /></p>

<p><label for="company"><span class="red">*</span> Company: </label><br />

<input id="company" name="company" type="text"
value="{$_POST['company']}" /></p>

<p><label for="phone"><span class="red">*</span> Phone: </label><br />

<input id="phone" name="phone" type="text" value="{$_POST['phone']}" /></p>

<p><label for="email"><span class="red">*</span> e-mail: </label><br />

<input id="email" name="email" type="text" value="{$_POST['email']}" /></p>

<p><label for="email2"><span class="red">*</span> re-enter e-mail:
</label><br />

<input id="email2" name="email2" type="text" value="{$_POST['email2']}" /></p>
</fieldset>
<fieldset>
<legend title="More Info.">More Info.</legend>
<p><label for="URL"><span class="red">*</span>  URL:</label><br />

<input id="URL" type="text" name="URL" value="{$_POST['URL']}"/> </p>

<p><label for="Contact_Preference"><span class="red">*</span>  Best
way to reach:</label><br />

<select name="Contact_Preference" id="Contact_Preference">
<option value="email">email</option>
<option value="phone">phone</option>
<option value="snail_mail">snail mail</option>

</select>
</p>

<p><label for="Contact_Time"><span class="red">*</span>  Best time to
contact:</label><br />

<select name="Contact_Time" id="Contact_Time">

<option value="morning">morning</option>
<option value="evening">evening</option>
<option value="anytime">anytime</option>

</select></p>

<input type="hidden" name="op" value="ds" />

<textarea name="message" id="message" rows="" cols="" >Send us a
detailed message specifying what you wish to accomplish with your web
site. </textarea>
<input class="submit" src="/images/submit.gif" alt="Submit"
type="image" name="submit"  />

</fieldset>
</form>
</div>
<p><span class="red">*</span> indicates a required field (all fields
are required).</p>
END_FORM;
if ($_POST['op']!='ds') {
    echo "$form_block";
    } else if ($_POST["op"] == "ds")  {

//Function saves time and space by eliminating unneccesary code
function check($fieldname)
        {
        global $err_msg;
        if($_POST[$fieldname] == "")
                {
                if ( !isset($err_msg)) { $err_msg = "<span class='red'>You 
haven't
entered your ".$fieldname."!</span><br />"; }
                elseif ( isset($err_msg)) { $err_msg="<span class='red'>You 
haven't
entered your ".$fieldname."!</span><br />"; }
                }
        return $err_msg;
        }

//////////////////////////
///Function execution/////
//////////////////////////

check('firstname');
check('lastname');
check('company');
check('phone');
check('email');
check('email2');
check('URL');
check('Contact_Preference');
check('Contact_Time');
check('message');

//Validating Email Address
if ($_POST['email'] != $_POST['email2']) { $email_err = "\n<span
class='red'>e-mail address fields do not match!</span>"; }

if (isset($err_msg) || isset($email_err)) { echo
$err_msg.$email_err."\n\n".$form_block; }
else {
  //it's ok to send, so build the mail
        $msg = "E-mail sent from www.inspired-evolution.com\n";
        $msg .="Sender's first name:        {$_POST['firstname']}\n";
        $msg .="Sender's last name:        {$_POST['lastname']}\n";
        $msg .="Company name:        {$_POST['company']}\n";
        $msg .="Senders Phone number:        {$_POST['phone']}\n";
        $msg .="Senders email address:        {$_POST['email']}\n";
        $msg .="Senders email address (re-typed):        {$_POST['email2']}\n";
        $msg .="The website is :        {$_POST['URL']}\n";
        $msg .="I prefer to be contacted via: {$_POST['Contact_Preference']}\n";
        $msg .="The Best time to contact is: {$_POST['Contact_Time']}\n";
        $msg .="Message:        {$_POST['message']}\n\n";
        $to ="[EMAIL PROTECTED]";
        $subject ="There has been a disturbance in the force";
        $mailheaders ="From: Inspired-Evolution.com
        <http://www.inspired-evolution.com>\n";
        $mailheaders .="Reply-To: {$_POST['email']}\n";
        //send the mail
        mail ($to, $subject, $msg, $mailheaders);
        //display information to user
  echo "<p>Hola, <strong>$firstname</strong>!.<br /><br />
We have received your request for a web site review , and will respond
shortly.<br />
Thanks for visiting inspired-evolution.com and have a wonderful day!<br /><br />
Regards,<br /><br />
<strong>Inspired Evolution</strong></p>";
}

}
?>

any assistance is greatly appreciated

--- End Message ---
--- Begin Message ---
On Wed, 2005-10-05 at 20:44, Bruce Gilbert wrote:
> I have a form that submits and returns on the same page and works fine.
> 
> I know want to change the submission action from   {$_SERVER['PHP_SELF']}
>
> to an external thanks page so the form method would change to:
> <form action="thanks.php" method="POST">

Why not just redirect to the thanks.php page when the submission is
complete? That will require the addition of one line to your form page:

    header( 'Location: thanks.php' );

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
thanks for the reply.

 and where on the page would that need to go? Within the head tags?
and would it need to be within <?php ?>

???

On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Wed, 2005-10-05 at 20:44, Bruce Gilbert wrote:
> > I have a form that submits and returns on the same page and works fine.
> >
> > I know want to change the submission action from   {$_SERVER['PHP_SELF']}
> >
> > to an external thanks page so the form method would change to:
> > <form action="thanks.php" method="POST">
>
> Why not just redirect to the thanks.php page when the submission is
> complete? That will require the addition of one line to your form page:
>
>     header( 'Location: thanks.php' );
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for       |
> | creating re-usable components quickly and easily.          |
> `------------------------------------------------------------'
>
>


--
::Bruce::

--- End Message ---
--- Begin Message ---
On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> thanks for the reply.
> 
>  and where on the page would that need to go? Within the head tags?
> and would it need to be within <?php ?>

Right after this line:

    mail ($to, $subject, $msg, $mailheaders);

And you will already be within PHP interpretation.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Sadly I thought of doing the same thing only to have my face crapped on by
this extreme lameness:

http://www.php.net/manual/en/ref.session.php

"Some types of data can not be serialized thus stored in sessions. It
includes resource variables or objects with circular references (i.e.
objects which passes a reference to itself to another object). "

If you figure out a way, please let me/us know... *sigh*

> -----Original Message-----
> From: Petr Smith [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 05, 2005 6:11 AM
> To: [email protected]
> Subject: [PHP] caching parsed XML files as DOM objects in memory
> 
> Hi,
> 
> is it possible to cache parsed XML files somehow? I'm writing 
> template 
> library based on XML. But it's not very efficient to create new 
> DomDocument, load XML template, process it and show on every 
> page hit. 
> XML parsing is not very fast, and because I'm parsing XHTML with 
> entities, all DTD's are parsed too. I thought about something 
> similar to 
> java - there I can have servlet which lives all the time the server 
> lives. It can load XML and parse it only for the first time 
> and send DOM 
> objects to another servlets.
> I need something similar with PHP, can it be done?
> 
> Thanks for any ideas,
> 
> Petr
> 
> ps. I found this project http://www.vl-srm.net/ which maybe can do 
> something I need, but it looks dead.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Petr Smith wrote:
is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets.
I need something similar with PHP, can it be done?

This question seems to come up every other week on this list. Have a look at APC[1]; you can cache objects with its apc_store() and apc_fetch() functions.

[1] http://php.net/apc
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene wrote:
Petr Smith wrote:

is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets.
I need something similar with PHP, can it be done?


This question seems to come up every other week on this list. Have a look at APC[1]; you can cache objects with its apc_store() and apc_fetch() functions.

[1] http://php.net/apc

Thanks, looks usable.. I hope it can synchronize successfully between different calls on heave load. I'll try it, I don't know why I missed it when browsing documentation.

Petr

--- End Message ---
--- Begin Message ---
it's not working at all. And it could never work. I don't think it's funny to write false advices to people "every other week". I've installed APC cache, tried to save XML. It was not working. apc_fetch returned NULL every time.
[snip]

When I looked into documentation for APC - there is this sentence: "And apc_store() currently doesn't work at all for (internal) classes in PHP5 right now.". And all the XML stuff is what? Internal PHP5 classes!

I can only apologise for your wasted time -- I seem to remember it working but may have been caching a different class; it was a while ago.

Perhaps Rasmus or someone with more knowledge of APC internals could comment? I find APC very useful but it would be extremely useful to be able to cache the DOMDocument class.

Could you please post the link to the docs from which you got that quote? I cannot find any words to that effect on either the php.net or pecl.php.net websites, but maybe I'm not looking hard enough...


Apology accepted. Sorry for my (maybe) too offensive language, I was disappointed it's not working.

This quote is from TODO "Known Bugs" file inside apc distribution archive (v3.0.8).

Petr

--- End Message ---
--- Begin Message ---
I have a class

        class XMLRule 
        {
         ...
        }

And many of these:

        class is_username extends XMLRule
        {
        }

        class is_device extends XMLRule
        {
        }

Is there a way in PHP5 to get a list of all the 'extends' classes I have
'defined' in my .php file?

I'm sure this is a long shot, but thought maybe through the Reflection class
or something? I really don't want to manually maintain an array if I don't
have to.

--- End Message ---
--- Begin Message ---
You can get an array of all declared classes with

http://de.php.net/manual/en/function.get-declared-classes.php

If you need more context (e.g. only subclasses of X)
you should definitely have a close look at the reflection api.

AllOLLi

____________
"Being lectured by the President on fiscal responsibility is like Tony
Soprano talking to me about law and order"
[Sen. John Kerry, 3rd debate]

--- End Message ---
--- Begin Message --- Do I need to use Pear to specify port 587 and authentication when sending mail? I could not find any way to do it using mail().
--- End Message ---
--- Begin Message ---
> Do I need to use Pear to specify port 587 and authentication when
> sending mail? I could not find any way to do it using mail().


Windows or Unix? On Windows you can set the port by setting smtp_port in
php.ini. Unix doesn't appear to have a direct equivalent, but you might be
able to do something with sendmail_path?

As for SMTP authentication, when I wanted to do this on Windows I went for
phpmailer
http://phpmailer.sourceforge.net/

Hope this is of some help

Mark

--- End Message ---
--- Begin Message ---
Hi,

I have been trying _several_ ways to control the size of the files that can be uploaded in a form.

The problem is that I was able to detect file size after complete file is transfered.

I need to detect file size before all file is transfered, in order to cancel it and preserve server resources.

Any ideas?

Thanks in advance
Ruben Rubio Rey

--- End Message ---
--- Begin Message ---
Ruben wrote:
I have been trying _several_ ways to control the size of the files that can be uploaded in a form.

The problem is that I was able to detect file size after complete file is transfered.

I need to detect file size before all file is transfered, in order to cancel it and preserve server resources.

Not possible unless you can write your own client app. Javascript etc.'s access to file controls is heavily restricted.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--- End Message ---
--- Begin Message ---
Saswat Praharaj wrote:

I guess checking the content-length field in HTTP header will help you.
I have already tried it. PHP can read content-length after complete file is transferred.

Regds,
-Saswat

On 10/6/05, Ruben <[EMAIL PROTECTED]> wrote:
Hi,

I have been trying _several_ ways to control the size of the files that
can be uploaded in a form.

The problem is that I was able to detect file size after complete file
is transfered.

I need to detect file size before all file is transfered, in order to
cancel it and preserve server resources.

Any ideas?

Thanks in advance
Ruben Rubio Rey

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





--- End Message ---
--- Begin Message ---
Petr Smith wrote:
Jasper Bryant-Greene wrote:

Petr Smith wrote:

is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets.
I need something similar with PHP, can it be done?



This question seems to come up every other week on this list. Have a look at APC[1]; you can cache objects with its apc_store() and apc_fetch() functions.

[1] http://php.net/apc


Thanks, looks usable.. I hope it can synchronize successfully between different calls on heave load. I'll try it, I don't know why I missed it when browsing documentation.

Petr

Hi,

it's not working at all. And it could never work. I don't think it's funny to write false advices to people "every other week". I've installed APC cache, tried to save XML. It was not working. apc_fetch returned NULL every time.

$dom = apc_fetch("dom");
if ($dom === false) {
        $dom = new DomDocument();
        $dom->load("browsers.html");       
        $store = apc_store("dom", $dom);
        echo "store finished: $store";
}
echo $dom->saveXML();

When I looked into documentation for APC - there is this sentence: "And apc_store() currently doesn't work at all for (internal) classes in PHP5 right now.". And all the XML stuff is what? Internal PHP5 classes!

Please don't confuse people with false edvices next time. Better to say nothing then solutions that are not working. I lost lot of time and got only ton of disapointment.

And still no solution to my problem :(.

Petr

--- End Message ---
--- Begin Message ---
Petr Smith wrote:

it's not working at all. And it could never work. I don't think it's funny to write false advices to people "every other week". I've installed APC cache, tried to save XML. It was not working. apc_fetch returned NULL every time.
[snip]

When I looked into documentation for APC - there is this sentence: "And apc_store() currently doesn't work at all for (internal) classes in PHP5 right now.". And all the XML stuff is what? Internal PHP5 classes!

I can only apologise for your wasted time -- I seem to remember it working but may have been caching a different class; it was a while ago.

Perhaps Rasmus or someone with more knowledge of APC internals could comment? I find APC very useful but it would be extremely useful to be able to cache the DOMDocument class.

Could you please post the link to the docs from which you got that quote? I cannot find any words to that effect on either the php.net or pecl.php.net websites, but maybe I'm not looking hard enough...

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--- End Message ---

Reply via email to