RE: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Micky Hulse
Well, I added this to the end of my .htaccess:

# Set the index page:
RedirectMatch ^/$ http://mydomain.com/folder/folder/index.php

Seems to work well, but I am still concerned about
pitfalls/optimization/consolidation... er, perfection? ;)

TIA, Cheers,
Micky

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



[PHP] imap_search and multiple criteria

2006-04-10 Thread James Nunnerley
Does the imap_search support multiple criteria?

 

I've got the following successfully returning the correct results:

 



 

However, when you try and put them in the same search 

e.g. $search = "BODY \"test\" OR SUBJECT \"test\""

 

It fails...

 

The only way in which I can see this can be done is by joining the various
arrays that are returned.  Is this best?

 

Thanks

Nunners



Re: [PHP] stripping enclosed text from PHP code

2006-04-10 Thread Robin Vickery
On 09/04/06, Winfried Meining <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am writing on a script that parses a PHP script and finds all function calls
> to check, if these functions exist. To do this, I needed a function that would
> strip out all text, which is enclosed in apostrophes or quotation marks. This
> is somewhat tricky, as the script needs to be aware of what really is an
> enclosed text and what is PHP code.

So use the built in tokenizer functions which know exactly what's
enclosed text and what is php code. Much quicker and more reliable
than trying to do the same job with regular expressions.

http://se.php.net/tokenizer

  -robin

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



[PHP] String /pattern formatting extraction question

2006-04-10 Thread Andy
Hi to all, 

I have the following pattern for a string:

text1 /ptext2 /otext3

Now, I want to extract the text by "patterns" from this string by the following 
rule:

no pattern -> text1 (what is before /o or /p)
/p -> text2 (what is after /p)
/o -> text3 (what is after /o)

The order betweeen /o and /p can be switched, so there is no rule that /p is 
before /o.

How can I do this? I tried ereg but no success.

Andy.

Re: [PHP] IP Address Filtering - Problem Continues

2006-04-10 Thread Rahul S. Johari
Ave,

I had to eliminate that option because his IP is varying drastically. There
is no range, it's just drastically varying. I wouldn't be surprised if he's
using an IP Spoofing script/program etcetera.


On 4/5/06 11:16 AM, "Jay Blanchard" <[EMAIL PROTECTED]> wrote:

> You could always block a range of IP addresses, but you may cut out a
> legitimate user.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] IP Address Filtering - Problem Continues

2006-04-10 Thread Rahul S. Johari
Ave,

I'm being left with lesser and lesser choices then to try CAPCHTA. I'm gonna
look into it now and see if I need to implement this now.

Thanks.


On 4/5/06 3:52 PM, "tedd" <[EMAIL PROTECTED]> wrote:

> 
> Not that I promote CAPCHTA, but there are simple solutions that will
> slow down some spam while allowing some with vision problems to pass,
> such as --
> 
> http://www.xn--ovg.com/captcha
> 
> -- namely, the graphic selection demo.
> 
> Granted it's not the best, it doesn't solve everything, and I never
> said it did (at least no one can prove it) -- so don't whack me for
> it -- it's just a suggestion.
> 
> 
> tedd

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



[PHP] Re: String /pattern formatting extraction question

2006-04-10 Thread Barry

Andy wrote:
Hi to all, 


I have the following pattern for a string:

text1 /ptext2 /otext3

Does it always look like that?
text1(whitespace)/ptext2(whitespace)/otext3

Then use explode to create an array from it
explode (" ",$stringpattern);


Now, I want to extract the text by "patterns" from this string by the following 
rule:

no pattern -> text1 (what is before /o or /p)
/p -> text2 (what is after /p)
/o -> text3 (what is after /o)

Here you can use ereg and foreach
foreach ($stringpattern as $key => $value)
  {
$variable = substr_count("/",$value);
if ($variable > 0) / has been found now extract the first two chars
  }

Or something like that ~


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] RSS Generation

2006-04-10 Thread Robbert van Andel
I am working on creating some RSS feeds on my website using PHP.  I'm still
learning RSS but it seems easy enough. I managed to create the RSS giving
the file a PHP extension.  When I tried saving it with an xml extension and
adding a .htaccess file to the directory in which the file was saved, I get
prompted to save the file instead of being able to view the file in a
browser.  The only line in the .htaccess file is AddType
application/x-httpd-php xml.  

 

First off, and I'm sorry that this isn't a PHP specific question, but does
RSS require an XML extension?  And if it does, how do I get the server to
serve the PHP file correctly if I rename it with the xml extension?

 

Thanks,

Robbert van Andel

 



Re: [PHP] RSS Generation

2006-04-10 Thread Michael Crute
On 4/10/06, Robbert van Andel <[EMAIL PROTECTED]> wrote:
> First off, and I'm sorry that this isn't a PHP specific question, but does
> RSS require an XML extension?  And if it does, how do I get the server to
> serve the PHP file correctly if I rename it with the xml extension?

No, you can use any extension you like for the RSS document, including
.php its the contents that matters.

-Mike


--

Michael E. Crute
http://mike.crute.org

It is a mistake to think you can solve any major problems just with potatoes.
--Douglas Adams

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



Re: [PHP] function by reference

2006-04-10 Thread tedd

It's the same thing for the most part...



Cheers,
Rob.


Rob:

No way dude -- that was too easy!

Boy, am I in love with this language -- it gives you plenty of 
shovels to dig yourself in as deep as you want.


Thanks Rob.

tedd
--

http://sperling.com

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



Re: [PHP] Re: String /pattern formatting extraction question

2006-04-10 Thread Andy

text1 /ptext2 /otext3

Does it always look like that?
text1(whitespace)/ptext2(whitespace)/otext3


The ideea is to extract the texts before and between /o and /p.
$html = "asdäüü ö ö vf /pxtestxx/ostestss";
eregi("^([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[1]
eregi("^(.*)/p([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
eregi("^(.*)/o([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]


This example works, but I thought there might be a better way to extract the
texts, with a single ereg or preg_match.

Regards,
Andy.

- Original Message - 
From: "Barry" <[EMAIL PROTECTED]>

To: 
Sent: Monday, April 10, 2006 4:22 PM
Subject: [PHP] Re: String /pattern formatting extraction question



Andy wrote:

Hi to all, I have the following pattern for a string:

text1 /ptext2 /otext3

Does it always look like that?
text1(whitespace)/ptext2(whitespace)/otext3

Then use explode to create an array from it
explode (" ",$stringpattern);


Now, I want to extract the text by "patterns" from this string by the 
following rule:


no pattern -> text1 (what is before /o or /p)
/p -> text2 (what is after /p)
/o -> text3 (what is after /o)

Here you can use ereg and foreach
foreach ($stringpattern as $key => $value)
  {
$variable = substr_count("/",$value);
if ($variable > 0) / has been found now extract the first two chars
  }

Or something like that ~


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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





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



Re: [PHP] Re: String /pattern formatting extraction question

2006-04-10 Thread Robin Vickery
On 10/04/06, Andy <[EMAIL PROTECTED]> wrote:
> >> text1 /ptext2 /otext3
> > Does it always look like that?
> > text1(whitespace)/ptext2(whitespace)/otext3
>
> The ideea is to extract the texts before and between /o and /p.
> $html = "asdäüü ö ö vf /pxtestxx/ostestss";
> eregi("^([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[1]
> eregi("^(.*)/p([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
> eregi("^(.*)/o([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
>
> This example works, but I thought there might be a better way to extract the
> texts, with a single ereg or preg_match.

Well... slightly.

preg_match( '#^(+)/p(.+)/o(.+)$#',
preg_replace('#^(.+)(/o.+)(/p.+)$#', '$1$3$2', $html), $reg);

  -robin

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



Re: [PHP] RSS Generation

2006-04-10 Thread Greg Schnippel
> ... When I tried saving it with an xml extension and
> adding a .htaccess file to the directory in which the file was saved, I get
> prompted to save the file instead of being able to view the file in a
> browser.  The only line in the .htaccess file is AddType
> application/x-httpd-php xml.

I had similar problems when trying to roll-my-own RSS feed with php.
Michael is right that it doesn't matter what your file extension is
(you probably don't even need that htaccess directive) as long as the
file is served as XML. Try adding a header at the top of the file:

header("Content-type: text/xml; charset=utf-8");




...

I also use the Firefox browser which has a built-in XML browser that
allows me to do a quick validation of the XML. You can also use
www.feedvalidator.org to troubleshoot your feed once its online.

- Greg

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



Re: [PHP] Argument passed by reference?

2006-04-10 Thread Joe Henry
On Friday 07 April 2006 5:06 pm, tedd wrote:
> At 1:52 PM -0500 4/6/06, Chris Boget wrote:
> >>The way I understand it, pass by reference in php is determined in
> >>the function definition and not the function call. Something like:
> >
> >You used to be able to pass by reference at run time.  But I see that is
> >no longer allowed... :|  So I guess that makes my question moot.
> >
> >Thanks for your help.
> >
> >thnx,
> >Chris
>
> Chris:
>
> Please forgive my ignorance, but when did that happen?
>
> tedd
> --
> ---
>- http://sperling.com

I'm not sure when this happened. I'm fairly new to php, myself. Maybe someone 
else could answer that?
-- 
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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



Re: [PHP] function by reference

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 09:42, tedd wrote:
> >It's the same thing for the most part...
> >
> > >
> >$a = 'f_a';
> >call_user_func( $a, $p1, $p2, $p3 )
> >
> >?>
> >
> >Cheers,
> >Rob.
> 
> Rob:
> 
> No way dude -- that was too easy!
> 
> Boy, am I in love with this language -- it gives you plenty of 
> shovels to dig yourself in as deep as you want.

*lol*. personally I prefer the other format which was what I tried to
illustrate with my original example:



All it means, is that once you have the name of a function in a variable
you can invoke the variable as a function and it will invoke the
function matching the variable's value. Some of this stuff can be really
useful for doing backwards compatibility with older versions of 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.  |
`'

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



Re: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Joe Wollard
Mickey,

I'm not an expert on the topic by any stretch of the imagination, but I seem
to recall reading that it's best to move everything into httpd.conf for
performance reasons. You may want to investigate that, but otherwise I don't
see anything wrong with what you're doing.


On 4/10/06, Micky Hulse <[EMAIL PROTECTED]> wrote:
>
> Well, I added this to the end of my .htaccess:
>
> # Set the index page:
> RedirectMatch ^/$ http://mydomain.com/folder/folder/index.php
>
> Seems to work well, but I am still concerned about
> pitfalls/optimization/consolidation... er, perfection? ;)
>
> TIA, Cheers,
> Micky
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] how to assign a value to a variable inside a class

2006-04-10 Thread Merlin


Hi there,

I would like to assign a value inside a class like this:

var $db_username = $old_name;

Unfortunatelly this does not work and I do get following error:
Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or 
T_FUNCTION or T_VAR or '}'


Thank you for any hint on how to place a correct syntax on this.

Merlin

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



Re: [PHP] how to assign a value to a variable inside a class

2006-04-10 Thread Brad Bonkoski

How about this:

class foo {
   var $name;

   function setName($value) {
  $this->name = $value;
   }
}

-B

Merlin wrote:



Hi there,

I would like to assign a value inside a class like this:

var $db_username = $old_name;

Unfortunatelly this does not work and I do get following error:
Parse error: syntax error, unexpected T_VARIABLE, expecting 
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'


Thank you for any hint on how to place a correct syntax on this.

Merlin



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



Re: [PHP] function by reference

2006-04-10 Thread tedd



 > Boy, am I in love with this language -- it gives you plenty of

 shovels to dig yourself in as deep as you want.


*lol*. personally I prefer the other format which was what I tried to
illustrate with my original example:


Oh, you illustrated it very well. I looked intently at it and learned 
from it. I'm just into "one focus" when I ask those type of 
questions. I had something very specific in mind and that last post 
you may hit the mark!


Thanks again.

tedd

--

http://sperling.com

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



Re: [PHP] how to assign a value to a variable inside a class

2006-04-10 Thread Dave Goodchild
use a setter function. Direct var assignments must be simple constants. A
setter function enforces encapsulation.

On 10/04/06, Merlin <[EMAIL PROTECTED]> wrote:
>
>
> Hi there,
>
> I would like to assign a value inside a class like this:
>
> var $db_username = $old_name;
>
> Unfortunatelly this does not work and I do get following error:
> Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION
> or
> T_FUNCTION or T_VAR or '}'
>
> Thank you for any hint on how to place a correct syntax on this.
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
http://www.web-buddha.co.uk
dynamic web programming from Reigate, Surrey UK

look out for e-karma, our new venture, coming soon!


Re: [PHP] RSS Generation

2006-04-10 Thread Dave Goodchild
If you want to serve .xml files as php, make the relevant change in the
http.conf file (if you are using apache).

On 10/04/06, Michael Crute <[EMAIL PROTECTED]> wrote:
>
> On 4/10/06, Robbert van Andel <[EMAIL PROTECTED]> wrote:
> > First off, and I'm sorry that this isn't a PHP specific question, but
> does
> > RSS require an XML extension?  And if it does, how do I get the server
> to
> > serve the PHP file correctly if I rename it with the xml extension?
>
> No, you can use any extension you like for the RSS document, including
> .php its the contents that matters.
>
> -Mike
>
>
> --
> 
> Michael E. Crute
> http://mike.crute.org
>
> It is a mistake to think you can solve any major problems just with
> potatoes.
> --Douglas Adams
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
http://www.web-buddha.co.uk
dynamic web programming from Reigate, Surrey UK

look out for e-karma, our new venture, coming soon!


Re: [PHP] RSS Generation

2006-04-10 Thread Frank Arensmeier

Robbert,

maybe it is only a typo, but you have written:

"xml." not ".xml" (notice the position of the dot).

/frank
10 apr 2006 kl. 15.37 skrev Robbert van Andel:

I am working on creating some RSS feeds on my website using PHP.   
I'm still
learning RSS but it seems easy enough. I managed to create the RSS  
giving
the file a PHP extension.  When I tried saving it with an xml  
extension and
adding a .htaccess file to the directory in which the file was  
saved, I get

prompted to save the file instead of being able to view the file in a
browser.  The only line in the .htaccess file is AddType
application/x-httpd-php xml.



First off, and I'm sorry that this isn't a PHP specific question,  
but does
RSS require an XML extension?  And if it does, how do I get the  
server to

serve the PHP file correctly if I rename it with the xml extension?



Thanks,

Robbert van Andel





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



[PHP] A question about max_execution_time

2006-04-10 Thread Eric Butera
Dear List,

I have been working with a PHP script that curls a file from another
server.  This works fine on my local machine, but not on our live server.
The script takes about 400 seconds to execute completely.  I was under the
impression that my call to set_time_limit(900); was helping.  Well, I took
that line out and nothing changed locally or on the server.  In fact I even
tried this little test:

max execution time: '. ini_get('max_execution_time');
sleep(40);
echo "done!";
echo "Script Executed Time: ". Util::displayMicroTime(
$_SCRIPT_START_TIME, Util::getMicroTime() );
die(''.__FILE__.__LINE__);
?>


Outputs:
max execution time: 30
done!

Script Executed Time: 40.01
/Users/eric/Sites/test/member_get_update.php26


Now why did this work?  Shouldn't the script have timed out after 30
seconds?

Thanks in advance!

Eric


RE: Re: [PHP] RSS Generation

2006-04-10 Thread php
Thanks.  I had added the header to the file.  If the php extension is good 
enough, then I am not going to worry about the .htaccess file.

>> ... When I tried saving it with an xml extension and
>> adding a .htaccess file to the directory in which the file was saved, I get
>> prompted to save the file instead of being able to view the file in a
>> browser.  The only line in the .htaccess file is AddType
>> application/x-httpd-php xml.
>
>I had similar problems when trying to roll-my-own RSS feed with php.
>Michael is right that it doesn't matter what your file extension is
>(you probably don't even need that htaccess directive) as long as the
>file is served as XML. Try adding a header at the top of the file:
>
>header("Content-type: text/xml; charset=utf-8");
>
>
>
>
>...
>
>I also use the Firefox browser which has a built-in XML browser that
>allows me to do a quick validation of the XML. You can also use
>www.feedvalidator.org to troubleshoot your feed once its online.
>
>- Greg
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

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



Re: [PHP] A question about max_execution_time

2006-04-10 Thread Ray Hauge
On Monday 10 April 2006 11:30, Eric Butera wrote:
> Dear List,
>
> I have been working with a PHP script that curls a file from another
> server.  This works fine on my local machine, but not on our live server.
> The script takes about 400 seconds to execute completely.  I was under the
> impression that my call to set_time_limit(900); was helping.  Well, I took
> that line out and nothing changed locally or on the server.  In fact I even
> tried this little test:
>
>  // header include for my config (to get Util)
> error_reporting(E_ALL);
> echo 'max execution time: '. ini_get('max_execution_time');
> sleep(40);
> echo "done!";
> echo "Script Executed Time: ". Util::displayMicroTime(
> $_SCRIPT_START_TIME, Util::getMicroTime() );
> die(''.__FILE__.__LINE__);
> ?>
>
>
> Outputs:
> max execution time: 30
> done!
>
> Script Executed Time: 40.01
> /Users/eric/Sites/test/member_get_update.php26
>
>
> Now why did this work?  Shouldn't the script have timed out after 30
> seconds?
>
> Thanks in advance!
>
> Eric

The information in set_time_limit() might help:

http://us3.php.net/set_time_limit

"Note:  The set_time_limit() function and the configuration directive 
max_execution_time only affect the execution time of the script itself. Any 
time spent on activity that happens outside the execution of the script such 
as system calls using system(), stream operations, database queries, etc. is 
not included when determining the maximum time that the script has been 
running."

HTH

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



RE: Re: [PHP] RSS Generation

2006-04-10 Thread php
Actually, the dot is the end of a sentence ... damn my excellnet grammar skills 
:)

In the htaccess file, I hadn't included a dot at either end of XML. I think I'm 
going to just leave the file extension as PHP and see how that goes.

Thanks,
Robbert

>Robbert,
>
>maybe it is only a typo, but you have written:
>
>"xml." not ".xml" (notice the position of the dot).
>
>/frank
>10 apr 2006 kl. 15.37 skrev Robbert van Andel:
>
>> I am working on creating some RSS feeds on my website using PHP.   
>> I'm still
>> learning RSS but it seems easy enough. I managed to create the RSS  
>> giving
>> the file a PHP extension.  When I tried saving it with an xml  
>> extension and
>> adding a .htaccess file to the directory in which the file was  
>> saved, I get
>> prompted to save the file instead of being able to view the file in a
>> browser.  The only line in the .htaccess file is AddType
>> application/x-httpd-php xml.
>>
>>
>>
>> First off, and I'm sorry that this isn't a PHP specific question,  
>> but does
>> RSS require an XML extension?  And if it does, how do I get the  
>> server to
>> serve the PHP file correctly if I rename it with the xml extension?
>>
>>
>>
>> Thanks,
>>
>> Robbert van Andel
>>
>>
>>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

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



Re: [PHP] A question about max_execution_time

2006-04-10 Thread Eric Butera
On 4/10/06, Ray Hauge <[EMAIL PROTECTED]> wrote:
>
> On Monday 10 April 2006 11:30, Eric Butera wrote:
> > Dear List,
> >
> > I have been working with a PHP script that curls a file from another
> > server.  This works fine on my local machine, but not on our live
> server.
> > The script takes about 400 seconds to execute completely.  I was under
> the
> > impression that my call to set_time_limit(900); was helping.  Well, I
> took
> > that line out and nothing changed locally or on the server.  In fact I
> even
> > tried this little test:
> >
> >  > // header include for my config (to get Util)
> > error_reporting(E_ALL);
> > echo 'max execution time: '. ini_get('max_execution_time');
> > sleep(40);
> > echo "done!";
> > echo "Script Executed Time: ". Util::displayMicroTime(
> > $_SCRIPT_START_TIME, Util::getMicroTime() );
> > die(''.__FILE__.__LINE__);
> > ?>
> >
> >
> > Outputs:
> > max execution time: 30
> > done!
> >
> > Script Executed Time: 40.01
> > /Users/eric/Sites/test/member_get_update.php26
> >
> >
> > Now why did this work?  Shouldn't the script have timed out after 30
> > seconds?
> >
> > Thanks in advance!
> >
> > Eric
>
> The information in set_time_limit() might help:
>
> http://us3.php.net/set_time_limit
>
> "Note:  The set_time_limit() function and the configuration directive
> max_execution_time only affect the execution time of the script itself.
> Any
> time spent on activity that happens outside the execution of the script
> such
> as system calls using system(), stream operations, database queries, etc.
> is
> not included when determining the maximum time that the script has been
> running."
>
> HTH
>
> --
> Ray Hauge
> Programmer/Systems Administrator
> American Student Loan Services
> www.americanstudentloan.com
> 1.800.575.1099
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




Ray,

Thank you for your response.  I did read that in the manual, I promise.
That is why I included the sleep function in my example.  Shouldn't the
sleep function count as execution time?  One thing I didn't metion earlier,
for the sake of simplicity, is that my script is pulling an XML file.  After
I get the XML file I parse through it which also takes time too.  The
recordset is about 6 thousand records so it does take a while.


Re: [PHP] A question about max_execution_time

2006-04-10 Thread Ray Hauge
On Monday 10 April 2006 11:48, Eric Butera wrote:
> Ray,
>
> Thank you for your response.  I did read that in the manual, I promise.
> That is why I included the sleep function in my example.  Shouldn't the
> sleep function count as execution time?  One thing I didn't metion earlier,
> for the sake of simplicity, is that my script is pulling an XML file. 
> After I get the XML file I parse through it which also takes time too.  The
> recordset is about 6 thousand records so it does take a while.

Right after I sent that I started wondering if sleep() would be counted in the 
time or not.  I would think it would, but it *could* in the background just 
run the system sleep, which might not be counted...  I don't know that much 
about the sleep function to tell you.  Parsing the XML should cause it to 
time out if it was longer than 9 seconds though... interesting situation...

At the moment I don't have much else for you :(

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



[PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
Hello all,

My website uses simpleXML to print the headlines from a few different RSS 
feeds. The problem is that sometimes the remote feed is unavailable if there 
are problems with the remote site, and the result is that I must wait for 30 
seconds or so until the HTTP timeout occurs, delaying the rendering of my 
site.

So far, I have moved the code that grabs the RSS feeds to the bottom of my 
page, so that the main page content is rendered first, but this is only a 
partial solution.

Is there a way to give the simplexml_load_file() a 5 second timeout before 
giving up and moving on? 

Here is my function:

function getFeed($remote) {
if (!$xml = simplexml_load_file($remote)) {
print "Feed unavailable";
return;
}
print "\n";
foreach ($xml->channel->item as $item) {
$cleaned = str_replace("&", "&", $item->link); 
print "$item->title\n";
}
print "\n";
}

PHP 5.1.2 on Linux.
thanks,
-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgpMd5exSvq6N.pgp
Description: PGP signature


Re: [PHP] A question about max_execution_time

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 1:48 pm, Eric Butera wrote:
> Thank you for your response.  I did read that in the manual, I
> promise.
> That is why I included the sleep function in my example.  Shouldn't
> the
> sleep function count as execution time?  One thing I didn't metion
> earlier,
> for the sake of simplicity, is that my script is pulling an XML file.
> After
> I get the XML file I parse through it which also takes time too.  The
> recordset is about 6 thousand records so it does take a while.

'sleep' doesn't count.

That's even in the 3rd to last User Contributed Note. :-)

Always read the Notes.  You may have to wade through some [bleep] but
you'll find some nuggets of info well worth the effort.

The primary goal of set_time_limit is to keep scripts from slamming
the server and taking ALL the CPU time.

If the script is sleeping, it's not taking CPU time.

I missed the beginning of the thread, but if you need to count 'sleep'
time, you'll just have to code it yourself somehow...

I suppose the first item on your agenda might be to contribute a
get_time_spent() function to the PHP source that returned whatever
value PHP is using to track this CPU usage. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Browser-based scanning

2006-04-10 Thread Dan Harrington
Hello everyone,

I am needing to build a system that allows a user to visit a website driven
by a unix hosted apache web server running PHP, login, and scan an image off
of a TWAIN-compliant scanning device, and upload it to the web server where
PHP and ImageMagick do some post-processing of the image.

Does anyone know of a PHP-based solution that does something like this?  The
link from the scanning device to the web server is the big unknown for me.
Do I have to use ActiveX?  Can ActiveX interface with PHP?

Thanks
Dan


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



Re: [PHP] RSS Generation

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 8:37 am, Robbert van Andel wrote:
> I am working on creating some RSS feeds on my website using PHP.  I'm
> still
> learning RSS but it seems easy enough. I managed to create the RSS
> giving
> the file a PHP extension.  When I tried saving it with an xml
> extension and
> adding a .htaccess file to the directory in which the file was saved,
> I get
> prompted to save the file instead of being able to view the file in a
> browser.  The only line in the .htaccess file is AddType
> application/x-httpd-php xml.
>
> First off, and I'm sorry that this isn't a PHP specific question, but
> does
> RSS require an XML extension?  And if it does, how do I get the server
> to
> serve the PHP file correctly if I rename it with the xml extension?

First off, check that httpd.conf is even USING .htaccess
You can find/read httpd.conf, or you can make a new directory with
index.html in it, surf to it, then put something totally bogus in an
.htaccess file in that directory.
If .htaccess is "on" then you'll get a 500 server error because of
your bogus .htaccess settings.

Next, you need to check WHAT you are allowed to override in .htaccess
For that, you'll have to actually read httpd.conf, if you can, or do a
LOT of experiments if your webhost has it non-readable.  (My webhost
used to do that, but he got smarter)

If all else fails, you can do:

http://example.com/rss.php/whatever.xml

where rss.php is your REAL script, and whatever.xml is junk that
Apache and PHP will cheerfully ignore.

Actually, they don't TOTALLY ignore it, they store it in
$_SERVER['PATH_INFO'] for you, in case you need it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: Re: [PHP] RSS Generation

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 1:36 pm, [EMAIL PROTECTED] wrote:
> Thanks.  I had added the header to the file.  If the php extension is
> good enough, then I am not going to worry about the .htaccess file.

I'd be awful careful here...

SOME versions of Microsoft IE are particularly stoopid about dealing
with URLs and Content-type etc.

SOME versions are even more weird when you add GET parameters to non
HTML document URLs. E.G.
http://example.com/myphpscript.pdf?date=5/1/2006
Where myphpscript.pdf has been ForceType in .htaccess to be PHP.

If I was you, I'd still try for the .xml ending and don't give the web
browsers who might link to your RSS feed any opportunity to [bleep]
up.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Browser-based scanning

2006-04-10 Thread John Nichel
Please turn *off* your mailer's request for return receipts when sending 
to a mailing list.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] Re: Implied permissions

2006-04-10 Thread Michael Felt

SLaVKa wrote:

Hey guys... implementing a permission system and just wanted some advice.

If i have permission A
which has implied permissions B and C

How do the permissions relate to each other, for eg if I select 
permission A to true, that implies that permission B and C must be set 
to true, but then if I set B to false or C to false, or both does that 
affect permission A?


Assuming that B, and C dont have implied rights you should be able to 
turn both of them off while leaving A on, but then that breaks the rule 
for A having implied permissions B and C.


Any help appreciated.

I dont know the Grammar for specifying logic anymore, but

IF A implies B + C, then reverse logic should imply that if !( B && C) 
== !A. In other words, it shouldnt matter which of B or C is false.


Or you could specify if ((!B) || (!C)) then A==FALSE.

But more importantly, YOU are specifying the permission system, so you 
must define the priority, implications, etc..


I would personally prefer a rule which had A = ( B && C ). In other 
words, A does not imply B and C are true, but is defined by there being 
true, or is dependent. The possible confusion wil come when you specify 
permissions as 'implications' rather than as combinations of 'conditions'.


My 2 cents.

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



Re: [PHP] String /pattern formatting extraction question

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 7:40 am, Andy wrote:
> Hi to all,
>
> I have the following pattern for a string:
>
> text1 /ptext2 /otext3
>
> Now, I want to extract the text by "patterns" from this string by the
> following rule:
>
> no pattern -> text1 (what is before /o or /p)
> /p -> text2 (what is after /p)
> /o -> text3 (what is after /o)
>
> The order betweeen /o and /p can be switched, so there is no rule that
> /p is before /o.
>
> How can I do this? I tried ereg but no success.

Will there always be at least one /p or /o?...

And I'm assuming you don't need the whitespace.

And that text2 and text3 must not have embedded whitespace.

Then you can do something like:



You may want to get a program called "The Regex Coach" which lets you
type patterns/input and see the output in real-time.  Incredibly
handy/useful.

Also, your syntax looks AMAZINGLY like the GetOpt patterns of command
line arguments...  If you could change '/' to '-', you'd find zillions
of pre-built libraries to handle your strings.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 12:50 am, Micky Hulse wrote:
>> -Original Message-
>> From: Chris [mailto:[EMAIL PROTECTED]
>> Do you need to do it with a mod_rewrite?
>>
>> if not, you can do it easily in php:
>>
>> header('location: folder/file.php');
>> exit();
>>
>> in index.php.
>
>
> Unfortunately, yes... I am using a CMS, and my current setup is
> forcing me
> into using the more complicated mod_rewrite.
>
> Well, not that it is a bad thing... seems like mod_rewrite is more
> search-engine/bot friendly.
>
> Thanks for the tip though, I really appreciate your time.

Another alternative, if mod_rewrite confuses you as much as it does me...

.htaccess

  ForceType application/x-httpd-php

DocumentIndex folder

folder


On the plus side, this doesn't force people into example.com when they
went to www.example.com -- It just works. :-)

PS

I you do stick with mod_rewrite, turn mod_rewrite_debug *ON* and tail
-f your http error_log for awhile.

You'll learn a lot about what will/won't work for mod_rewrite in your
rules...

The warnings about mod_rewrite debugging/logging performance issues
are a bit over-stated, I think...

Or, at least, you need to do this on a development server with "real"
traffic patterns for your testing, if doing it live is a non-option.

Doing it on only the URLs *you* think of typing doesn't count.  Those
pesky real users can come up with some really interesting URLs to
type... :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 15:25, darren kirby wrote:
> Hello all,
> 
> My website uses simpleXML to print the headlines from a few different RSS 
> feeds. The problem is that sometimes the remote feed is unavailable if there 
> are problems with the remote site, and the result is that I must wait for 30 
> seconds or so until the HTTP timeout occurs, delaying the rendering of my 
> site.
> 
> So far, I have moved the code that grabs the RSS feeds to the bottom of my 
> page, so that the main page content is rendered first, but this is only a 
> partial solution.
> 
> Is there a way to give the simplexml_load_file() a 5 second timeout before 
> giving up and moving on? 
> 
> Here is my function:
> 
> function getFeed($remote) {
> if (!$xml = simplexml_load_file($remote)) {
> print "Feed unavailable";
> return;
> }
> print "\n";
> foreach ($xml->channel->item as $item) {
> $cleaned = str_replace("&", "&", $item->link); 
> print "$item->title\n";
> }
> print "\n";
> }

Why do you do this on every request? Why not have a cron job retrieve an
update every 20 minutes or whatnot and stuff it into a database table
for your page to access? Then if the cron fails to retrieve the feed it
can just leave the table as is, and your visitors can happily view
slightly outdated feeds? Additionally this will be so much faster that
your users might even hang around on your site :)

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.  |
`'

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



[PHP] String is not zero-terminated

2006-04-10 Thread Richard Lynch
In order to attempt to figure out why my script segfaults PHP (5.0.4,
5.1.2, 5.1.3RC3) I've been compiling --with-debug

That then gives me warnings such as:

Run-time warning. String is not zero-terminated (ÿØÿà) (source:
/www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
in /www/acousticdemo.com/web/info.com/overture/overture.inc:128
Run-time warning. String is not zero-terminated (ÿØÿà) (source:
/www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
in /www/acousticdemo.com/web/info.com/overture/ocr.inc:59

Are these a symptom of my problem, or just:
"Duh.  It's a JPEG.  It's binary data.  It's not GOING to be
zero-terminated.  Ignore it, goofball."

A Google was not successful in yielding an answer to this question...

PS
Intermittent segfaults.
Not fun.
Very.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] String is not zero-terminated

2006-04-10 Thread Kristen G. Thorson
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 10, 2006 4:44 PM
To: php-general@lists.php.net
Subject: [PHP] String is not zero-terminated

In order to attempt to figure out why my script segfaults PHP (5.0.4,
5.1.2, 5.1.3RC3) I've been compiling --with-debug

That then gives me warnings such as:

Run-time warning. String is not zero-terminated (ÿØÿà) (source:
/www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
in /www/acousticdemo.com/web/info.com/overture/overture.inc:128
Run-time warning. String is not zero-terminated (ÿØÿà) (source:
/www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
in /www/acousticdemo.com/web/info.com/overture/ocr.inc:59






Did you see this?

http://mail-archives.apache.org/mod_mbox/perl-docs-dev/200309.mbox/[EMAIL 
PROTECTED]

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Robert Cummings:
>
> Why do you do this on every request? Why not have a cron job retrieve an
> update every 20 minutes or whatnot and stuff it into a database table
> for your page to access? Then if the cron fails to retrieve the feed it
> can just leave the table as is, and your visitors can happily view
> slightly outdated feeds? Additionally this will be so much faster that
> your users might even hang around on your site :)

This is a very interesting idea, but I am not sure if it is suitable for me at 
this point. First of all, one feed in particular can change in a matter of 
seconds, and I do want it to be as up to date as possible. Secondly, this is 
just for my personal site which is very low traffic, and it is not 
inconceivable that getting the feed every 20 minutes by cron would be _more_ 
taxing on the network than simply grabbing it per request...

And to be fair, when everything is working as it should the feeds are 
retrieved in a matter of seconds, and I don't think it is annoying my users 
at all. It is the 0.5% of requests when the remote site is overloaded (or 
just plain down) that I want to provision for here.

I do like this idea of caching the feed though. I think in my situation 
though, rather than prefetching the feed at regular intervals it may be 
better to cache the most recent request, and check the age of the cache when 
the next request comes. This way, I would not be needlessly updating it for 
those times when the page with my feeds goes for a few hours without a 
request.

Of course, this still wouldn't solve my original problem.

> Cheers,
> Rob.
> --

Thanks for your insight,
-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgp80qbla946k.pgp
Description: PGP signature


Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 17:46, darren kirby wrote:
> quoth the Robert Cummings:
> >
> > Why do you do this on every request? Why not have a cron job retrieve an
> > update every 20 minutes or whatnot and stuff it into a database table
> > for your page to access? Then if the cron fails to retrieve the feed it
> > can just leave the table as is, and your visitors can happily view
> > slightly outdated feeds? Additionally this will be so much faster that
> > your users might even hang around on your site :)
> 
> This is a very interesting idea, but I am not sure if it is suitable for me 
> at 
> this point. First of all, one feed in particular can change in a matter of 
> seconds, and I do want it to be as up to date as possible. Secondly, this is 
> just for my personal site which is very low traffic, and it is not 
> inconceivable that getting the feed every 20 minutes by cron would be _more_ 
> taxing on the network than simply grabbing it per request...
> 
> And to be fair, when everything is working as it should the feeds are 
> retrieved in a matter of seconds, and I don't think it is annoying my users 
> at all. It is the 0.5% of requests when the remote site is overloaded (or 
> just plain down) that I want to provision for here.
> 
> I do like this idea of caching the feed though. I think in my situation 
> though, rather than prefetching the feed at regular intervals it may be 
> better to cache the most recent request, and check the age of the cache when 
> the next request comes. This way, I would not be needlessly updating it for 
> those times when the page with my feeds goes for a few hours without a 
> request.
> 
> Of course, this still wouldn't solve my original problem.

Well personal websites break all the rules. There's nobody to answer to
but yourself :)

Looks like simplexml neglected to offer a timeout option. You would
probably be better off using curl to retrieve the content, then using
simplexml_load_string(). Curl does allow you to assign a timeout.

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.  |
`'

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Robert Cummings:
> On Mon, 2006-04-10 at 17:46, darren kirby wrote:
> > quoth the Robert Cummings:
> > > Why do you do this on every request? Why not have a cron job retrieve
> > > an update every 20 minutes or whatnot and stuff it into a database
> > > table for your page to access? Then if the cron fails to retrieve the
> > > feed it can just leave the table as is, and your visitors can happily
> > > view slightly outdated feeds? Additionally this will be so much faster
> > > that your users might even hang around on your site :)
> >
> > This is a very interesting idea, but I am not sure if it is suitable for
> > me at this point. First of all, one feed in particular can change in a
> > matter of seconds, and I do want it to be as up to date as possible.
> > Secondly, this is just for my personal site which is very low traffic,
> > and it is not inconceivable that getting the feed every 20 minutes by
> > cron would be _more_ taxing on the network than simply grabbing it per
> > request...
> >
> > And to be fair, when everything is working as it should the feeds are
> > retrieved in a matter of seconds, and I don't think it is annoying my
> > users at all. It is the 0.5% of requests when the remote site is
> > overloaded (or just plain down) that I want to provision for here.
> >
> > I do like this idea of caching the feed though. I think in my situation
> > though, rather than prefetching the feed at regular intervals it may be
> > better to cache the most recent request, and check the age of the cache
> > when the next request comes. This way, I would not be needlessly updating
> > it for those times when the page with my feeds goes for a few hours
> > without a request.
> >
> > Of course, this still wouldn't solve my original problem.
>
> Well personal websites break all the rules. There's nobody to answer to
> but yourself :)
>
> Looks like simplexml neglected to offer a timeout option. You would
> probably be better off using curl to retrieve the content, then using
> simplexml_load_string(). Curl does allow you to assign a timeout.

That's the ticket! Thanks a lot for your help.

> Cheers,
> Rob.

-d

> ..
>
> | 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.  |
>
> `'

-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgp1pVIKLSoO2.pgp
Description: PGP signature


Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Martin Alterisio
Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().

PS: I forgot to reply to all and mention you'll have to send the GET
http command and headers, check the php manual for examples.

2006/4/10, darren kirby <[EMAIL PROTECTED]>:
> Hello all,
>
> My website uses simpleXML to print the headlines from a few different RSS
> feeds. The problem is that sometimes the remote feed is unavailable if there
> are problems with the remote site, and the result is that I must wait for 30
> seconds or so until the HTTP timeout occurs, delaying the rendering of my
> site.
>
> So far, I have moved the code that grabs the RSS feeds to the bottom of my
> page, so that the main page content is rendered first, but this is only a
> partial solution.
>
> Is there a way to give the simplexml_load_file() a 5 second timeout before
> giving up and moving on?
>
> Here is my function:
>
> function getFeed($remote) {
> if (!$xml = simplexml_load_file($remote)) {
> print "Feed unavailable";
> return;
> }
> print "\n";
> foreach ($xml->channel->item as $item) {
> $cleaned = str_replace("&", "&", $item->link);
> print "$item->title\n";
> }
> print "\n";
> }
>
> PHP 5.1.2 on Linux.
> thanks,
> -d
> --
> darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
> "...the number of UNIX installations has grown to 10, with more expected..."
> - Dennis Ritchie and Ken Thompson, June 1972
>
>
>

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby

quoth the Martin Alterisio:
> Maybe you can read the contents of the feeds using fsockopen() and
> stream_set_timeout() to adjust the timeout, or stream_set_blocking()
> to read it asynchronously, and then load the xml with
> simplexml_load_string().

Hello, and thanks for the response,

As Robert Cummings suggested above, the easy solution is to use curl, which 
does offer a timeout option, and then feed it to simplexml_load_string().

I am writing some code now...

Thanks, and have a good one,
-d

-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgpn7Z5Ag4G6c.pgp
Description: PGP signature


RE: [PHP] String is not zero-terminated

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 4:40 pm, Kristen G. Thorson wrote:
> -Original Message-
> From: Richard Lynch [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 10, 2006 4:44 PM
> To: php-general@lists.php.net
> Subject: [PHP] String is not zero-terminated
>
> In order to attempt to figure out why my script segfaults PHP (5.0.4,
> 5.1.2, 5.1.3RC3) I've been compiling --with-debug
>
> That then gives me warnings such as:
>
> Run-time warning. String is not zero-terminated (ÿØÿà) (source:
> /www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
> in /www/acousticdemo.com/web/info.com/overture/overture.inc:128
> Run-time warning. String is not zero-terminated (ÿØÿà) (source:
> /www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
> in /www/acousticdemo.com/web/info.com/overture/ocr.inc:59
>
> 
>
>
>
>
> Did you see this?
>
> http://mail-archives.apache.org/mod_mbox/perl-docs-dev/200309.mbox/[EMAIL 
> PROTECTED]

Yes.

I should have said from the get-go I was running as CLI, which, unless
I'm really being naive, means mod_perl cannot be involved.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Browser-based scanning

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 2:33 pm, Dan Harrington wrote:
> I am needing to build a system that allows a user to visit a website
> driven
> by a unix hosted apache web server running PHP, login, and scan an
> image off
> of a TWAIN-compliant scanning device, and upload it to the web server
> where
> PHP and ImageMagick do some post-processing of the image.
>
> Does anyone know of a PHP-based solution that does something like
> this?  The
> link from the scanning device to the web server is the big unknown for
> me.
> Do I have to use ActiveX?  Can ActiveX interface with PHP?

Is the TWAIN device tied to the server?

Cuz PHP runs on the server.

So if the scanner is connected to their desktop, PHP isn't going to be
involved, at all, really.

Your question might be:  "Does anybody know of any web-based
widget/control that can be used to force a user's scanner to operate?"

But then, it has nothing to do with PHP.

The ONLY way you could tie in PHP would be if you were to use PHP-GTK
http://gtk.php.net and if PHP-GTK had some kind of interface/module to
talk to scanners, which I sincerely doubt, but it's at least in the
realm of "possible" instead of "impossible" which is where you are at
right now trying to tie PHP on your web-server to my scanner.

I don't think it's a particularly good idea that you'd be able to mess
with MY scanner from your web-site, thank you very much!

Who knows what sort of private document I might have in my scanner!

Think about this for awhile, and I think you'll realize why your
question not only doesn't make sense, it SHOULDN'T make sense.

Unless you're building a desktop application with PHP GTK.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] String is not zero-terminated

2006-04-10 Thread Curt Zirzow
On Mon, Apr 10, 2006 at 03:43:55PM -0500, Richard Lynch wrote:
> In order to attempt to figure out why my script segfaults PHP (5.0.4,
> 5.1.2, 5.1.3RC3) I've been compiling --with-debug
> 
> That then gives me warnings such as:
> 
> Run-time warning. String is not zero-terminated () (source:
> /www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45)
> in /www/acousticdemo.com/web/info.com/overture/overture.inc:128

I assume you have zend_debug turned on.  Basically php will be safe
with this warning, since it shouldn't be relying on the \0
terminator but the actual length of the string.  I belive this
warning is in place to help migrate from the dependency of \0.

One thing you might want to check is what is triggering this error,
if you are doing a strlen() call this error shouldn't be issued,
IMO.  If operation you are doing rely's on the terminating \0, it
most likely should get fixed in php.

One thing you could check is the archives of the php-devel list to
see if there is talk about this.

HTH,

curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf

Martin Alterisio wrote:

Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().

PS: I forgot to reply to all and mention you'll have to send the GET
http command and headers, check the php manual for examples.


You can just use fopen() to avoid all that.

eg.

$fd = fopen($url);
stream_set_blocking($fd,true);
stream_set_timeout($fd, 5);  // 5-second timeout
$data = stream_get_contents($fd);
$status = stream_get_meta_data($fd);
if($status['timed_out']) echo "Time out";
else {
  $xml = simplexml_load_string($data);
}

As for your caching, make sure you create the cache file atomically.  So 
how about this:


function request_cache($url, $dest_file, $ctimeout=60, $rtimeout=5) {
  if(!file_exists($dest_file) || filemtime($dest_file) < 
(time()-$ctimeout)) {

$stream = fopen($url,'r');
stream_set_blocking($stream,true);
stream_set_timeout($stream, $rtimeout);
$tmpf = tempnam('/tmp','YWS');
file_put_contents($tmpf, $stream);
fclose($stream);
rename($tmpf, $dest_file);
  }
}

That takes the url to your feed, a destination file to cache to, a cache 
timeout (as in, fetch from the feed if the cache is older than 60 
seconds) and finally the request timeout.


Note the file_put_contents of the stream straight to disk, so you don't 
ever suck the file into memory.  You can then use a SAX parser like 
xmlreader on it and your memory usage will be minimal.  You will need 
PHP 5.1.x for this to work.


You could also use apc_store/fetch and skip the disk copy altogether.

(untested and typed up during a long boring meeting, so play with it a bit)

-Rasmus

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 4:46 pm, darren kirby wrote:
> quoth the Robert Cummings:
>>
>> Why do you do this on every request? Why not have a cron job
>> retrieve an
>> update every 20 minutes or whatnot and stuff it into a database
>> table
>> for your page to access? Then if the cron fails to retrieve the feed
>> it
>> can just leave the table as is, and your visitors can happily view
>> slightly outdated feeds? Additionally this will be so much faster
>> that
>> your users might even hang around on your site :)
>
> This is a very interesting idea, but I am not sure if it is suitable
> for me at
> this point. First of all, one feed in particular can change in a
> matter of
> seconds, and I do want it to be as up to date as possible. Secondly,
> this is
> just for my personal site which is very low traffic, and it is not
> inconceivable that getting the feed every 20 minutes by cron would be
> _more_
> taxing on the network than simply grabbing it per request...

Perhaps, then, you should:
maintain a list of URLs and acceptable "age" of feed.
Attempt to snag the new content upon visit, if the content is "old"
Show the "old" content if the feed takes longer than X seconds.

You'll STILL need a timeout, which, unfortunately, means you are stuck
rolling your own solution with http://php.net/fsockopen because all
the "simple" solutions pretty much suck in terms of network timeout.
:-(

It would be REALLY NIFTY if fopen and friends which understand all
those protocols of HTTP FTP HTTPS and so on, allowed one to set a
timeout for URLs, but they don't and nobody with the skills to change
that (not me) seems even mildly interested. :-( :-( :-(

Since I've already written a class that does something like what you
want, or maybe even exactly what you want, I might as well just
provide the source, eh?

http://l-i-e.com/FeedMulti/FeedMulti.phps

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Micky Hulse
 > -Original Message-
> From: Joe Wollard [mailto:[EMAIL PROTECTED] 
> I'm not an expert on the topic by any stretch of the 
> imagination, but I seem to recall reading that it's best to 
> move everything into httpd.conf for performance reasons. You 
> may want to investigate that, but otherwise I don't see 
> anything wrong with what you're doing.

Sounds good to me, thanks so much for you help. Reading about httpd.conf
now.

Have a great day/week/month/year/...
Cheers,
Micky

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 6:17 pm, Rasmus Lerdorf wrote:
> Martin Alterisio wrote:
>> Maybe you can read the contents of the feeds using fsockopen() and
>> stream_set_timeout() to adjust the timeout, or stream_set_blocking()
>> to read it asynchronously, and then load the xml with
>> simplexml_load_string().
>>
>> PS: I forgot to reply to all and mention you'll have to send the GET
>> http command and headers, check the php manual for examples.
>
> You can just use fopen() to avoid all that.

No, he can't.

Sorry, Rasmus. :-)

If the URL is not working at the time of fopen() then you'll sit there
spinning your wheels waiting for fopen() itself to timeout, before you
ever GET a valid file handle to which one can apply stream_set_timeout
and/or stream_set_blocking.

That can take MUCH too long.

So you're STUCK with fsockopen, which DOES take a timeout parameter
for OPENING the socket, as well as giving one a stream to which
stream_set_blocking and stream_set_timeout can be applied.

But then you are stuck re-inventing the damn wheel with any protocol
you'd like to support like GET/POST, HTTPS (ugh!), FTP and so on.

All of which is buried in the guts of the Truly Nifty fopen,
file_get_contents, and so forth, but is utterly useless if you care at
all about timing out in a reasonably-responsive application.

So you have do all the junk to send things like:
GET / HTTP/1.0
Host: example.com
yourself, and God help you if you want to support HTTPS.

Actually, curl MAY be the better solution -- but my boss doesn't have
curl installed, so I was screwed anyway...

This is why I (and others) have put in a Feature Request to get
fopen() and friends to have some kind of programmatically changable
timeout setting.  Said Feature Requests invariably get marked "Bogus"
and then commented with something like the non-solution above. :-)

Oh well.

It *can* be done; You just have to type WAY too much junk to do
something very simple and very commonly needed.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Micky Hulse
Hi Richard,

> Doing it on only the URLs *you* think of typing doesn't count.  Those
> pesky real users can come up with some really interesting URLs to
> type... :-)

Lol, I was thinking that might be a problem.

Thanks for all the great tips, I really appreicate your help.

Great info... I am looking forward to learning more about the information
you presented.

Btw, anyone have any good tips for setting-up outlook to format list emails
better? I just got a PC and am coming from the Mac world (Mail app was
pretty simple compared to all the Microsoft bells and whistles)...

Have a good one,
Cheers,
Micky

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



Re: [PHP] String is not zero-terminated

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 6:14 pm, Curt Zirzow wrote:
> One thing you might want to check is what is triggering this error,
> if you are doing a strlen() call this error shouldn't be issued,
> IMO.  If operation you are doing rely's on the terminating \0, it
> most likely should get fixed in php.

I'm just doing stristr($jpeg_data, 'http://l-i-e.com/artists.htm

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Richard Lynch:
> Perhaps, then, you should:
> maintain a list of URLs and acceptable "age" of feed.
> Attempt to snag the new content upon visit, if the content is "old"
> Show the "old" content if the feed takes longer than X seconds.

I really do like this idea, as I would rather use an old feed than just print 
"Feed unavailable" as I have it now.

> You'll STILL need a timeout, which, unfortunately, means you are stuck
> rolling your own solution with http://php.net/fsockopen because all
> the "simple" solutions pretty much suck in terms of network timeout.
>
> :-(
>
> It would be REALLY NIFTY if fopen and friends which understand all
> those protocols of HTTP FTP HTTPS and so on, allowed one to set a
> timeout for URLs, but they don't and nobody with the skills to change
> that (not me) seems even mildly interested. :-( :-( :-(

I am interested, but I don't have the skills either...

> Since I've already written a class that does something like what you
> want, or maybe even exactly what you want, I might as well just
> provide the source, eh?
>
> http://l-i-e.com/FeedMulti/FeedMulti.phps

Thanks for that, it looks like interesting code, if not a little over my head. 
I am just a duffer here. I will certainly play with it some more. As for 
curl, I realized I didn't add curl support myself, so I am rebuilding PHP 
now... 

When I do get something figured out I will post results here. Problem is, with 
either method I need to find a feed that is slow to test with. If I test it 
with a bunk url it will just 404 immediately right? Is there a way to 
simulate a slow connection?

> --
> Like Music?
> http://l-i-e.com/artists.htm

Thanks a lot for the help, everybody!
-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgp8eJbTMrXbb.pgp
Description: PGP signature


Re: [PHP] Argument passed by reference?

2006-04-10 Thread Chris

Joe Henry wrote:

On Friday 07 April 2006 5:06 pm, tedd wrote:


At 1:52 PM -0500 4/6/06, Chris Boget wrote:


The way I understand it, pass by reference in php is determined in
the function definition and not the function call. Something like:


You used to be able to pass by reference at run time.  But I see that is
no longer allowed... :|  So I guess that makes my question moot.

Thanks for your help.

thnx,
Chris


Chris:

Please forgive my ignorance, but when did that happen?


I'm not sure when this happened. I'm fairly new to php, myself. Maybe someone 
else could answer that?



It's not that it's not allowed, it's that it should be done differently. 
You should make the function accept a reference in the definition, not 
pass in a reference to the function.


The manual page has a good, simple example on what to do.

http://www.php.net/manual/en/language.references.pass.php

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 20:52, darren kirby wrote:
> quoth the Richard Lynch:
> > Perhaps, then, you should:
> > maintain a list of URLs and acceptable "age" of feed.
> > Attempt to snag the new content upon visit, if the content is "old"
> > Show the "old" content if the feed takes longer than X seconds.
> 
> I really do like this idea, as I would rather use an old feed than just print 
> "Feed unavailable" as I have it now.
> 
> > You'll STILL need a timeout, which, unfortunately, means you are stuck
> > rolling your own solution with http://php.net/fsockopen because all
> > the "simple" solutions pretty much suck in terms of network timeout.
> >
> > :-(
> >
> > It would be REALLY NIFTY if fopen and friends which understand all
> > those protocols of HTTP FTP HTTPS and so on, allowed one to set a
> > timeout for URLs, but they don't and nobody with the skills to change
> > that (not me) seems even mildly interested. :-( :-( :-(
> 
> I am interested, but I don't have the skills either...
> 
> > Since I've already written a class that does something like what you
> > want, or maybe even exactly what you want, I might as well just
> > provide the source, eh?
> >
> > http://l-i-e.com/FeedMulti/FeedMulti.phps
> 
> Thanks for that, it looks like interesting code, if not a little over my 
> head. 
> I am just a duffer here. I will certainly play with it some more. As for 
> curl, I realized I didn't add curl support myself, so I am rebuilding PHP 
> now... 
> 
> When I do get something figured out I will post results here. Problem is, 
> with 
> either method I need to find a feed that is slow to test with. If I test it 
> with a bunk url it will just 404 immediately right? Is there a way to 
> simulate a slow connection?

For sure ;) Pull your ethernet cable out. Doesn't get much slower :D

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.  |
`'

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



RE: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 7:08 pm, Micky Hulse wrote:
>> Doing it on only the URLs *you* think of typing doesn't count.
>> Those
>> pesky real users can come up with some really interesting URLs to
>> type... :-)
>
> Lol, I was thinking that might be a problem.
>
> Thanks for all the great tips, I really appreicate your help.
>
> Great info... I am looking forward to learning more about the
> information
> you presented.
>
> Btw, anyone have any good tips for setting-up outlook to format list
> emails
> better? I just got a PC and am coming from the Mac world (Mail app was
> pretty simple compared to all the Microsoft bells and whistles)...

Abandon Outlook and use Eudora, or Pegasus, or webmail, or ANYTHING
other than Outlook? :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Argument passed by reference?

2006-04-10 Thread tedd
It's not that it's not allowed, it's that it should be done 
differently. You should make the function accept a reference in the 
definition, not pass in a reference to the function.


The manual page has a good, simple example on what to do.

http://www.php.net/manual/en/language.references.pass.php


Chris:

Interesting. One would think (at least I do) it should be the other way around.

Using the example given at the link above:



We have one function that works one way.



However, doing it this way, the function can serve two purposes. I 
can send it a reference or I could send it a value. I know that in 
this function a value doesn't do anything, but it could if the 
function was different.


Plus, in the first function, I can't send it a reference (i.e., a 
reference to a reference?).


What's short reasoning for this being recommended this way? What am I 
not seeing?


tedd
--

http://sperling.com

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
> When I do get something figured out I will post results here. Problem
> is, with
> either method I need to find a feed that is slow to test with. If I
> test it
> with a bunk url it will just 404 immediately right? Is there a way to
> simulate a slow connection?

I dunno about similating a slow connection, but you can write a very
slow server... :-)

my_slow_rss_feed.php
Darren Kirby';
  sleep(10);
  for ($i = 0; $i < strlen($data); $i++){
echo $data[$i];
flush();
sleep(1);
  }
?>

Of course, that doesn't simulate the slow connection part of it...

If you have 2 machines, you can unplug the network cable, start your
script, then plug the cable in after 5 seconds.

That's gonna make it pretty slow to connect, almost for sure. :-)

If anybody is goofy enough to complain about the performance of
strlen() in the for(...) statement, you're clearly not paying
attention. :-) :-) :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Argument passed by reference?

2006-04-10 Thread Chris

tedd wrote:
It's not that it's not allowed, it's that it should be done 
differently. You should make the function accept a reference in the 
definition, not pass in a reference to the function.


The manual page has a good, simple example on what to do.

http://www.php.net/manual/en/language.references.pass.php



Chris:

Interesting. One would think (at least I do) it should be the other way 
around.


Using the example given at the link above:



We have one function that works one way.



However, doing it this way, the function can serve two purposes. I can 
send it a reference or I could send it a value. I know that in this 
function a value doesn't do anything, but it could if the function was 
different.


Plus, in the first function, I can't send it a reference (i.e., a 
reference to a reference?).


I'd guess it's to simplify things.

Having been involved in a big cms that used references all over the 
place (everything was OO), it was extremely hard to find / track down 
where they should be and where they were missing - which caused memory 
blow-outs where they were not used, and segfault crashes where they were 
incorrectly used.


If they were all in the function definitions, I don't have to worry 
about that particular problem.


However, it's something the developers would have to give a definitive 
answer on.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] php with ajax - uploading pictures

2006-04-10 Thread Richard Lynch
On Sun, April 9, 2006 3:21 pm, Merlin wrote:
> I am searching for a good upload framework that works with PHP and
> AJAX
> to provide an upload interface that uploads one picture instantly,
> shows
> the thumbnail and displays another upload formfield to select the next
> picture for upload.
>
> Is there something like this, or similar around?

I dunno where you plan to put the AJAX part...

upload.php
\n";
}
  }
?>

  Upload an image: 


thumbnail.php


You're on your own to add the error checking, test the error setting
of $_FILES, validate the image to avoid being a warez site, handling
goofballs who name their .jpg files as something else like '.jpeg', or
handling other image formats or...

But, really, it's not exactly a complicated script...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] stripping enclosed text from PHP code

2006-04-10 Thread Richard Lynch
Have you considered running php -s from the command line, which syntax
highlights your source file for you, the searching for whatever color
codes in your php.ini are used for functions?

For that matter, you could custom-code the choices for the color and
make the functions read in a separate php.ini

On Sun, April 9, 2006 3:20 pm, Winfried Meining wrote:
>
> Hi,
>
> I am writing on a script that parses a PHP script and finds all
> function calls
> to check, if these functions exist. To do this, I needed a function
> that would
> strip out all text, which is enclosed in apostrophes or quotation
> marks. This
> is somewhat tricky, as the script needs to be aware of what really is
> an
> enclosed text and what is PHP code. Apostrophes in quotation mark
> enclosed text
> should be ignored and quotation marks in apostrophe enclosed text
> should be
> ignored, as well. Similarly, escaped apostrophes in apostrophe
> enclosed text
> and escaped quotation marks in quotation mark enclosed text should be
> ignored.
>
> The following function uses preg_match to do this job.
>
> 
> function stripstrings($text) {
>   while (preg_match("/^(.*)(?
>   $front = $matches[1];
>   $lim = $matches[2];
>   $tail = $matches[3];
>
>   while (preg_match("/^(.*)(? $matches)) {
>   $front = $matches[1];
>   $tail = $matches[3] . $lim . $tail;
>   $lim = $matches[2];
>   }
>
>   if (!preg_match("/^(.*)(?   break;
>
>   $string = $matches[1];
>   $tail = $matches[2];
>   while (preg_match("/^(.*)(? $matches)) {
>   $string = $matches[1];
>   $tail = $matches[2] . $lim . $tail;
>   }
>
>   $text = $front . $tail;
>   }
>
>   return($text);
> }
>
> ?>
>
> I noticed that this function is very slow, in particular because
>
> preg_match("/^(.*)some_string(.*)$/", $text, $matches);
>
> always seems to find the *last* occurrence of some_string and not the
> *first*
> (I would need the first). There is certainly a way to write another
> version
> where one looks at every single character when going through $text,
> but this
> would make the code much more complex.
>
> I wonder, if there is a faster *and* simple way to do the same thing.
>
> Is there btw a script freely available, which can parse PHP code and
> check for
> errors ?
>
> Any help is highly appreciated.
>
> Winfried
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] function by reference

2006-04-10 Thread Richard Lynch


On Sun, April 9, 2006 1:17 pm, tedd wrote:
> Hi gang:
>
> Not that I have an immediate need for this, but in other languages
> one can access a function by reference (in other words, it's address
> -- such as call(function address) ).
>
> In php, one can pass a variable by reference by simply using the
> ampersand, such a &$a.
>
> Is there a similar way to reference a function?
>
> Rob, was kind enough to post the following code, but I was looking
> for something where I could store the function's address in a
> variable. Something like:
>
> $a = &f_a();
>
> And then, where I could use call_user_func($a); (or something
> similar) and the function would do it's thing -- anything like that?
>
> Thanks
>
> tedd
>
> --- Rob's suggestion follows.
>
> Like the following?
>
> 
> function f_a()
> {
>  echo 'a';
> }
>
> function f_b()
> {
>  echo 'b';
> }
>
> function f_c()
> {
>  echo 'c';
> }
>
> $map = array
> (
>  'a' => 'f_a',
>  'b' => 'f_b',
>  'c' => 'f_c',
> );
>
> $map['a']();
> $map['b']();
> $map['c']();
>
> ?>
>
>
> --
> 
> http://sperling.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] function by reference

2006-04-10 Thread Ray Hauge
On Monday 10 April 2006 19:19, Richard Lynch wrote:
> On Sun, April 9, 2006 1:17 pm, tedd wrote:
> > Hi gang:
> >
> > Not that I have an immediate need for this, but in other languages
> > one can access a function by reference (in other words, it's address
> > -- such as call(function address) ).
> >
> > In php, one can pass a variable by reference by simply using the
> > ampersand, such a &$a.
> >
> > Is there a similar way to reference a function?
> >
> > Rob, was kind enough to post the following code, but I was looking
> > for something where I could store the function's address in a
> > variable. Something like:
> >
> > $a = &f_a();
> >
> > And then, where I could use call_user_func($a); (or something
> > similar) and the function would do it's thing -- anything like that?
> >
> > Thanks
> >
> > tedd
> >
> > --- Rob's suggestion follows.
> >
> > Like the following?
> >
> >  >
> > function f_a()
> > {
> >  echo 'a';
> > }
> >
> > function f_b()
> > {
> >  echo 'b';
> > }
> >
> > function f_c()
> > {
> >  echo 'c';
> > }
> >
> > $map = array
> > (
> >  'a' => 'f_a',
> >  'b' => 'f_b',
> >  'c' => 'f_c',
> > );
> >
> > $map['a']();
> > $map['b']();
> > $map['c']();
> >
> > ?>
> >
> >
> > --
> > -
> >--- http://sperling.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> Like Music?
> http://l-i-e.com/artists.htm

I believe you're thinking more of the C++ style of returning by reference.  
This article should help explain how references work, and how to return 
references... most specifically check the "Returning References" section.

http://www.php.net/manual/en/language.references.php

HTH
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] function by reference

2006-04-10 Thread Ray Hauge
>
> I believe you're thinking more of the C++ style of returning by reference.
> This article should help explain how references work, and how to return
> references... most specifically check the "Returning References" section.
>
> http://www.php.net/manual/en/language.references.php
>
> HTH
> --
> Ray Hauge
> Programmer/Systems Administrator
> American Student Loan Services
> www.americanstudentloan.com
> 1.800.575.1099

nevermind... I what I read and what was actually written seem to have been two 
entirely different things ;)  Still good info though.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Martin Alterisio \"El Hombre Gris\"
Maybe it's too late to say this, but if your real problem is that you 
don't want the function reading
the rss feed to block the rest of your page, you can always put the 
output of the reading of the feed

on a separate page, and include this through an iframe.

darren kirby wrote:


Hello all,

My website uses simpleXML to print the headlines from a few different RSS 
feeds. The problem is that sometimes the remote feed is unavailable if there 
are problems with the remote site, and the result is that I must wait for 30 
seconds or so until the HTTP timeout occurs, delaying the rendering of my 
site.


So far, I have moved the code that grabs the RSS feeds to the bottom of my 
page, so that the main page content is rendered first, but this is only a 
partial solution.


Is there a way to give the simplexml_load_file() a 5 second timeout before 
giving up and moving on? 


Here is my function:

function getFeed($remote) {
   if (!$xml = simplexml_load_file($remote)) {
   print "Feed unavailable";
   return;
   }
   print "\n";
   foreach ($xml->channel->item as $item) {
   $cleaned = str_replace("&", "&", $item->link); 
   print "$item->title\n";

   }
   print "\n";
}

PHP 5.1.2 on Linux.
thanks,
-d
 



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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf

Richard Lynch wrote:

On Mon, April 10, 2006 6:17 pm, Rasmus Lerdorf wrote:

Martin Alterisio wrote:

Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().

PS: I forgot to reply to all and mention you'll have to send the GET
http command and headers, check the php manual for examples.

You can just use fopen() to avoid all that.


No, he can't.

Sorry, Rasmus. :-)

If the URL is not working at the time of fopen() then you'll sit there
spinning your wheels waiting for fopen() itself to timeout, before you
ever GET a valid file handle to which one can apply stream_set_timeout
and/or stream_set_blocking.


I thought it was the case of an overloaded slow-responding server, not 
one that is down.  For the initial connection just set your 
default_socket_timeout appropriately if you are not happy with the default.


So you just add 1 line to my example:

function request_cache($url, $dest_file, $ctimeout=60, $rtimeout=5) {
  if(!file_exists($dest_file) || filemtime($dest_file) < 
(time()-$ctimeout)) {

ini_set('default_socket_timeout',$rtimeout);
$stream = fopen($url,'r');
stream_set_blocking($stream,true);
stream_set_timeout($stream, $rtimeout);
$tmpf = tempnam('/tmp','YWS');
file_put_contents($tmpf, $stream);
fclose($stream);
rename($tmpf, $dest_file);
  }
}

Problem solved.

-Rasmus

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



[PHP] PHP and CakePHP: How to use the $html->selectTag()

2006-04-10 Thread Pham Huu Le Quoc Phuc
Hi everybody!
I'm a newbie. My question maybe very funny. But please answer to me if you
have any ideas.
I use $html->selectTag(), I don't know how to use OnChange.
When User choose a item on SelectTag, I want Browser to redirect another
page and get current value.

Thank so much!

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf

Richard Lynch wrote:

It would be REALLY NIFTY if fopen and friends which understand all
those protocols of HTTP FTP HTTPS and so on, allowed one to set a
timeout for URLs, but they don't and nobody with the skills to change
that (not me) seems even mildly interested. :-( :-( :-(


Because it is already there and has been since Sept.23 2002 when it was 
added.


-Rasmus

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



RE: [PHP] mod_rewrite q's: syntax?

2006-04-10 Thread Micky Hulse
> -Original Message-
> From: Richard Lynch [mailto:[EMAIL PROTECTED] 
> Abandon Outlook and use Eudora, or Pegasus, or webmail, or ANYTHING
> other than Outlook? :-)

LOL! Yeah, I do not know what I was thinking in the first place... Eudora
sounds good to me.  :D

Cheers,
Micky

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



Re: [PHP] php with ajax - uploading pictures

2006-04-10 Thread Manuel Lemos
Hello,

On Sun, April 9, 2006 3:21 pm, Merlin wrote:
> I am searching for a good upload framework that works with PHP and
> AJAX
> to provide an upload interface that uploads one picture instantly,

Yes, try this forms class that comes with plug-in named AJAX form
submit. It can submit any form using without reloading the whole page.
On the server side you can make the class respond to an AJAX form
submission with several types of actions like updating parts of the page
to give the user some feedback. Take a look at the test_ajax_form.php
example script.

http://www.phpclasses.org/formgeneration



> shows
> the thumbnail and displays another upload formfield to select the next
> picture for upload.
>
> Is there something like this, or similar around?

That is not exactly AJAX, but rather DHTML (HTML page elements generated
dynamically with Javascript.

It can be something as simple as:


More






-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote:
> Richard Lynch wrote:
>> It would be REALLY NIFTY if fopen and friends which understand all
>> those protocols of HTTP FTP HTTPS and so on, allowed one to set a
>> timeout for URLs, but they don't and nobody with the skills to
>> change
>> that (not me) seems even mildly interested. :-( :-( :-(
>
> Because it is already there and has been since Sept.23 2002 when it
> was
> added.

I've added a Note to 'fopen' so maybe others won't completely miss
this feature and look as foolish as I do right now. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf

Richard Lynch wrote:

On Mon, April 10, 2006 4:46 pm, darren kirby wrote:

quoth the Robert Cummings:

Why do you do this on every request? Why not have a cron job
retrieve an
update every 20 minutes or whatnot and stuff it into a database
table
for your page to access? Then if the cron fails to retrieve the feed
it
can just leave the table as is, and your visitors can happily view
slightly outdated feeds? Additionally this will be so much faster
that
your users might even hang around on your site :)

This is a very interesting idea, but I am not sure if it is suitable
for me at
this point. First of all, one feed in particular can change in a
matter of
seconds, and I do want it to be as up to date as possible. Secondly,
this is
just for my personal site which is very low traffic, and it is not
inconceivable that getting the feed every 20 minutes by cron would be
_more_
taxing on the network than simply grabbing it per request...


Perhaps, then, you should:
maintain a list of URLs and acceptable "age" of feed.
Attempt to snag the new content upon visit, if the content is "old"
Show the "old" content if the feed takes longer than X seconds.

You'll STILL need a timeout, which, unfortunately, means you are stuck
rolling your own solution with http://php.net/fsockopen because all
the "simple" solutions pretty much suck in terms of network timeout.
:-(

It would be REALLY NIFTY if fopen and friends which understand all
those protocols of HTTP FTP HTTPS and so on, allowed one to set a
timeout for URLs, but they don't and nobody with the skills to change
that (not me) seems even mildly interested. :-( :-( :-(

Since I've already written a class that does something like what you
want, or maybe even exactly what you want, I might as well just
provide the source, eh?

http://l-i-e.com/FeedMulti/FeedMulti.phps


No stream_select() ?

Here is an example Wez wrote years ago:

 $host) {
$s = stream_socket_client("$host:80", $errno, $errstr, $timeout,
STREAM_CLIENT_ASYNC_CONNECT);

if ($s) {
$sockets[$id] = $s;
$status[$id] = "in progress";
} else {
$status[$id] = "failed, $errno $errstr";
}
}

/* Now, wait for the results to come back in */
while (count($sockets)) {
$read = $write = $sockets;
/* This is the magic function - explained below */
$n = stream_select($read, $write, $e = null, $timeout);

if ($n > 0) {
/* readable sockets either have data for us, or are failed
 * connection attempts */
foreach ($read as $r) {
$id = array_search($r, $sockets);
$data = fread($r, 8192);
if (strlen($data) == 0) {
if ($status[$id] == "in progress") {
$status[$id] = "failed to connect";
}
fclose($r);
unset($sockets[$id]);
} else {
$status[$id] .= $data;
}
}
/* writeable sockets can accept an HTTP request */
foreach ($write as $w) {
$id = array_search($w, $sockets);
fwrite($w, "HEAD / HTTP/1.0\r\nHost: "
. $hosts[$id] .  "\r\n\r\n");
$status[$id] = "waiting for response";
}
} else {
/* timed out waiting; assume that all hosts associated
 * with $sockets are faulty */
foreach ($sockets as $id => $s) {
$status[$id] = "timed out " . $status[$id];
}
break;
}
}

foreach ($hosts as $id => $host) {
echo "Host: $host\n";
echo "Status: " . $status[$id] . "\n\n";
}
?>

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 23:11, Richard Lynch wrote:
> On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote:
> > Richard Lynch wrote:
> >> It would be REALLY NIFTY if fopen and friends which understand all
> >> those protocols of HTTP FTP HTTPS and so on, allowed one to set a
> >> timeout for URLs, but they don't and nobody with the skills to
> >> change
> >> that (not me) seems even mildly interested. :-( :-( :-(
> >
> > Because it is already there and has been since Sept.23 2002 when it
> > was
> > added.
> 
> I've added a Note to 'fopen' so maybe others won't completely miss
> this feature and look as foolish as I do right now. :-)

If it's anything like the helpful note I added about using copy( source,
dest ) where dest accidentally points to source (due to linking), you'll
get a nice retarded email like the following:

---

You are receiving this email because your note posted
to the online PHP manual has been removed by one of the editors.

Read the following paragraphs carefully, because they contain
pointers to resources better suited for requesting support or
reporting bugs, none of which are to be included in manual notes
because there are mechanisms and groups in place to deal with
those issues.

The user contributed notes are not an appropriate place to
ask questions, report bugs or suggest new features; please
use the resources listed on 
for those purposes. This was clearly stated in the page
you used to submit your note, please carefully re-read
those instructions before submitting future contributions.

Bug submissions and feature requests should be entered at
. For documentation errors use the
bug system, and classify the bug as "Documentation problem".
Support and ways to find answers to your questions can be found
at .

Your note has been removed from the online manual.

- Copy of your note below -

User tip... it can be completely befuddling if you don't realize your
source and destination files are the same (this can happen with
directory links). When this happens there are a couple of
possibilities... at first I was using php 4.4.0 and the files just
became 0 length. The second, outcome after I upgraded to 4.4.2 (since I
didn't realize the problem) was that the copy function returned a
failure. This was tricky to track since there's no error output
indicating why the copy failed :)

-- 
..
| 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.  |
`'

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf

Robert Cummings wrote:

On Mon, 2006-04-10 at 23:11, Richard Lynch wrote:

On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote:

Richard Lynch wrote:

It would be REALLY NIFTY if fopen and friends which understand all
those protocols of HTTP FTP HTTPS and so on, allowed one to set a
timeout for URLs, but they don't and nobody with the skills to
change
that (not me) seems even mildly interested. :-( :-( :-(

Because it is already there and has been since Sept.23 2002 when it
was
added.

I've added a Note to 'fopen' so maybe others won't completely miss
this feature and look as foolish as I do right now. :-)


If it's anything like the helpful note I added about using copy( source,
dest ) where dest accidentally points to source (due to linking), you'll
get a nice retarded email like the following:


You could volunteer to help maintain the user notes.  It it thankless 
and tedious work to keep up with the flood of user notes being 
submitted.  A huge percentage of them being either spam, product pitches 
or really dumb questions.  The fact that occasionally a useful note gets 
deleted by mistake doesn't surprise me.


-Rasmus

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 23:35, Rasmus Lerdorf wrote:
> Robert Cummings wrote:
>
> > 
> > I'll keep that in mind for the future when I have more free time (2 kids
> > under 3 is good for keeping me occupied beyond work atm :).
> > 
> >>   A huge percentage of them being either spam, product pitches 
> >> or really dumb questions.  The fact that occasionally a useful note gets 
> >> deleted by mistake doesn't surprise me.
> > 
> > Point taken, just sort of feels like  slap in the face after you go to
> > the effort to write a useful note :)
> 
> Yes, but just keep in mind that the folks on the other end make the 
> effort every single day to cull through hundreds of these.  We have 
> small kids and real jobs as well.  I am typing this with a 4-year old 
> sitting in my lap doing his best to make a dinosaur stomp on my keys. 

Ummm, that was a sincere "I'll keep it in mind". And I know all about
typing away with a newborn sleeping on my chest, a 1 year old pawing the
screen, a 2 year old mashing the keys and cackling mischievously.

> So while I sympathize with the fact that the work you put into this note 
> wasn't appreciated, please recognize that you are not being very 
> appreciative of the hundreds of hours of work the folks on the other end 
> are putting in.

I'm very appreciative, but at the same time, I don't feel like I
shouldn't comment on the potential of getting your note trashed like so
much spam. Don't forget, adding a note IS contributing. I usually add as
I see fit, I've added in the past, I'm sure I'll add in the future. But
now I'm a little on the twice shy side of the coin.

>   In general the user notes in the manual are useful. 
> There isn't much spam, and when something slips through it gets caught 
> rather quickly.  This stuff doesn't happen by itself.

Exactly, it doesn't happen by itself, neither do the notes. It's a
dovetailing arrangement. People add notes, people trim spam. It takes
both for either system to work. Agreed, though that adding notes isn't
the same as spending countless hours pruning.

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.  |
`'

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 23:24, Rasmus Lerdorf wrote:
> Robert Cummings wrote:
> > On Mon, 2006-04-10 at 23:11, Richard Lynch wrote:
> >> On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote:
> >>> Richard Lynch wrote:
>  It would be REALLY NIFTY if fopen and friends which understand all
>  those protocols of HTTP FTP HTTPS and so on, allowed one to set a
>  timeout for URLs, but they don't and nobody with the skills to
>  change
>  that (not me) seems even mildly interested. :-( :-( :-(
> >>> Because it is already there and has been since Sept.23 2002 when it
> >>> was
> >>> added.
> >> I've added a Note to 'fopen' so maybe others won't completely miss
> >> this feature and look as foolish as I do right now. :-)
> > 
> > If it's anything like the helpful note I added about using copy( source,
> > dest ) where dest accidentally points to source (due to linking), you'll
> > get a nice retarded email like the following:
> 
> You could volunteer to help maintain the user notes.  It it thankless 
> and tedious work to keep up with the flood of user notes being 
> submitted.

I'll keep that in mind for the future when I have more free time (2 kids
under 3 is good for keeping me occupied beyond work atm :).

>   A huge percentage of them being either spam, product pitches 
> or really dumb questions.  The fact that occasionally a useful note gets 
> deleted by mistake doesn't surprise me.

Point taken, just sort of feels like  slap in the face after you go to
the effort to write a useful note :)

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.  |
`'

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



Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf

Robert Cummings wrote:

On Mon, 2006-04-10 at 23:24, Rasmus Lerdorf wrote:

Robert Cummings wrote:

On Mon, 2006-04-10 at 23:11, Richard Lynch wrote:

On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote:

Richard Lynch wrote:

It would be REALLY NIFTY if fopen and friends which understand all
those protocols of HTTP FTP HTTPS and so on, allowed one to set a
timeout for URLs, but they don't and nobody with the skills to
change
that (not me) seems even mildly interested. :-( :-( :-(

Because it is already there and has been since Sept.23 2002 when it
was
added.

I've added a Note to 'fopen' so maybe others won't completely miss
this feature and look as foolish as I do right now. :-)

If it's anything like the helpful note I added about using copy( source,
dest ) where dest accidentally points to source (due to linking), you'll
get a nice retarded email like the following:
You could volunteer to help maintain the user notes.  It it thankless 
and tedious work to keep up with the flood of user notes being 
submitted.


I'll keep that in mind for the future when I have more free time (2 kids
under 3 is good for keeping me occupied beyond work atm :).

  A huge percentage of them being either spam, product pitches 
or really dumb questions.  The fact that occasionally a useful note gets 
deleted by mistake doesn't surprise me.


Point taken, just sort of feels like  slap in the face after you go to
the effort to write a useful note :)


Yes, but just keep in mind that the folks on the other end make the 
effort every single day to cull through hundreds of these.  We have 
small kids and real jobs as well.  I am typing this with a 4-year old 
sitting in my lap doing his best to make a dinosaur stomp on my keys. 
So while I sympathize with the fact that the work you put into this note 
wasn't appreciated, please recognize that you are not being very 
appreciative of the hundreds of hours of work the folks on the other end 
are putting in.  In general the user notes in the manual are useful. 
There isn't much spam, and when something slips through it gets caught 
rather quickly.  This stuff doesn't happen by itself.


-Rasmus

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



[PHP] flash file to recognize SESSION or REQUEST variables?

2006-04-10 Thread Sunnrunner
A client asked me this question. Does anyone know what it means or can
someone explain and give me an answer. 

Thanks. T

How can we get the link in the URL of the flash file to recognize SESSION or
REQUEST variables? You know like GET or POST? I need to do something like.

url =
"https://secure.store.com/HousewivesUnleashed.306/buy.cfm?p=1000141&m=306&dc
wid=$_REQUEST['aid']&udfo2=$_REQUEST['sid']";

as opposed to what we currently have.

url = "https://secure.
store.com/HousewivesUnleashed.306/buy.cfm?p=1000141&m=306";

Thoughts?

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



[PHP] Need MySql Help Please

2006-04-10 Thread marvin hunkin

Hi.
any mysql gurus out there using a tool called EasyPHP 1-8?
i am using a my sql tutorial, and says needs the command line interface, so 
can run my sql commands from the dos prompt.

have got the PHP MYSQL ADMIM to load into the easy php 1-8, gui interface.
and when i type http://localhost/mysql/ it loads the browser, but would like 
the command line interface for version 5.0 of the my sql databaser admin 
server.
now if any good soul, who uses my sql, or my sql admin, or easy php, can 
show me how to set up the command line interface for Easy Php 1-8, then let 
me know.
have tried looking on the net, and looking in the documentation, and 
folders, but cannot seem to set it up.

okay if any one can help me out, let me know.
cheers Marvin.
ps: need this info, as doing the tutorial towards the database assignment 
for my course.


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



RE: [PHP] flash file to recognize SESSION or REQUEST variables?

2006-04-10 Thread Dan Harrington
You are either asking one of two things, and I am not sure which:

A) How to send information using GET or POST out from flash to a script file
SendAndLoad is the flash function
http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/h
tml/wwhelp.htm?context=Flash_MX_2004&file=1419.html


B) How to get Flash to load variables passed to it via HTTP GET?
Flash automatically loads these variables into the _root timeline
So
http://foo.bar.com/someflashfile.swf?variable1=joy
You would have _root.variable1 and the value in that variable would be "joy"

Hope this helpsand sorry if I misunderstood your question.
Dan

 

-Original Message-
From: Sunnrunner [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 10, 2006 10:47 PM
To: php-general@lists.php.net
Subject: [PHP] flash file to recognize SESSION or REQUEST variables?

A client asked me this question. Does anyone know what it means or can
someone explain and give me an answer. 

Thanks. T

How can we get the link in the URL of the flash file to recognize SESSION or
REQUEST variables? You know like GET or POST? I need to do something like.

url =
"https://secure.store.com/HousewivesUnleashed.306/buy.cfm?p=1000141&m=306&dc
wid=$_REQUEST['aid']&udfo2=$_REQUEST['sid']";

as opposed to what we currently have.

url = "https://secure.
store.com/HousewivesUnleashed.306/buy.cfm?p=1000141&m=306";

Thoughts?

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

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



Re: [PHP] Need MySql Help Please

2006-04-10 Thread Joe Wollard
Marvin,

As much as we try to keep this list PHP-only I think it's hard to
ignore the ties between PHP and MySQL. Most of us learned both
technologies simultaneously. Still, you may want to put [OT] on your
future email subjects to indicate that the question is 'off topic'.

On the matter of MySQL's command line: From what I can see on
http://dev.mysql.com/downloads/mysql/5.0.html it looks like when you
download the Windows binaries you don't get the option of just
downloading the client or just downloading the server - you are
downloading both (someone correct me if I'm wrong) in the 'essentials'
package. I'd imagine that when you run the installer it gives you an
option to install the server / client packages. As long as you told
the installer to give you the server and client both then you should
be in good shape. All you should need to do is make sure that A) the
MySQL binary (probably C:\Program Files\MySQL\MySQL Server
5.0\bin\mysql) is in your PATH environment variable and that B) the
server is running (which from the sounds of things, it is). If it's in
your path you should be able to start the client shell by simply
typing "mysql -u marvin -p" or similar.

You also might check out MySQL's documentation on running MySQL from
the command line in Windows
http://dev.mysql.com/doc/refman/5.0/en/windows-start-command-line.html

Good luck!
- Joe

On 4/11/06, marvin hunkin <[EMAIL PROTECTED]> wrote:
> Hi.
> any mysql gurus out there using a tool called EasyPHP 1-8?
> i am using a my sql tutorial, and says needs the command line interface, so
> can run my sql commands from the dos prompt.
> have got the PHP MYSQL ADMIM to load into the easy php 1-8, gui interface.
> and when i type http://localhost/mysql/ it loads the browser, but would like
> the command line interface for version 5.0 of the my sql databaser admin
> server.
> now if any good soul, who uses my sql, or my sql admin, or easy php, can
> show me how to set up the command line interface for Easy Php 1-8, then let
> me know.
> have tried looking on the net, and looking in the documentation, and
> folders, but cannot seem to set it up.
> okay if any one can help me out, let me know.
> cheers Marvin.
> ps: need this info, as doing the tutorial towards the database assignment
> for my course.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] I am not able to download domxml for PHP5

2006-04-10 Thread Oz
Please help, I am not able to download domxml for PHP5
I have tried this location,
http://us3.php.net/manual/en/ref.domxml.php

I get a message file not found.

is there a mirror site.

Thanks

Please also mail response to
[EMAIL PROTECTED] 

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



Re: [PHP] I am not able to download domxml for PHP5

2006-04-10 Thread Joe Wollard
Oz,

>From your command line, try:

pecl install domxml

You'll need to be root to do so, but as long as you have PECL/PEAR
installed this should give you domxml. Remember to restart your web
server after doing so.

- Joe


On 4/11/06, Oz <[EMAIL PROTECTED]> wrote:
> Please help, I am not able to download domxml for PHP5
> I have tried this location,
> http://us3.php.net/manual/en/ref.domxml.php
>
> I get a message file not found.
>
> is there a mirror site.
>
> Thanks
>
> Please also mail response to
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] I am not able to download domxml for PHP5

2006-04-10 Thread Joe Wollard
Of course you said you're running PHP5so that won't work.
According to the site it would be best for you to use the DOM that
comes pre compiled with PHP. http://us3.php.net/manual/en/ref.dom.php

Sorry about the mix up on my part.


On 4/11/06, Joe Wollard <[EMAIL PROTECTED]> wrote:
> Oz,
>
> From your command line, try:
>
> pecl install domxml
>
> You'll need to be root to do so, but as long as you have PECL/PEAR
> installed this should give you domxml. Remember to restart your web
> server after doing so.
>
> - Joe
>
>
> On 4/11/06, Oz <[EMAIL PROTECTED]> wrote:
> > Please help, I am not able to download domxml for PHP5
> > I have tried this location,
> > http://us3.php.net/manual/en/ref.domxml.php
> >
> > I get a message file not found.
> >
> > is there a mirror site.
> >
> > Thanks
> >
> > Please also mail response to
> > [EMAIL PROTECTED]
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

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