php-general Digest 8 Apr 2005 12:33:00 -0000 Issue 3385

Topics (messages 212603 through 212636):

mysql regexp select questions
        212603 by: Andras Kende
        212614 by: Eli

pasring complex string question
        212604 by: Webmaster
        212616 by: Eli
        212617 by: Eli

Re: another non php Q
        212605 by: Richard Lynch

Re: php user groups - searching for php developers for a project...
        212606 by: michael

Re: slow session_start()
        212607 by: Richard Lynch

Re: CURL running form PHP exec() problem!
        212608 by: Richard Lynch

using rand()
        212609 by: Ryan A
        212611 by: Ryan A

Question about clients
        212610 by: karl james

Smart Trimming of UTF-8 Entities for Database
        212612 by: C Drozdowski
        212615 by: Eli

Re: sql question
        212613 by: shimuqiheb.abchina.com

Extern Executions (Perl)
        212618 by: Eli

class constructor & polymorphism
        212619 by: silverio.di.qem.it
        212632 by: Josip Dzolonga

Re: Need help: change a string in a file
        212620 by: Saswat Praharaj

threaded comments
        212621 by: Sebastian
        212626 by: Jochem Maas
        212627 by: Kim Madsen

php wget: Return an empty file
        212622 by: Chris Blake
        212633 by: Josip Dzolonga
        212635 by: Chris Blake

Multilingual Web application - how to?
        212623 by: Denis Gerasimov
        212625 by: Jochem Maas
        212629 by: Eli

Re: php wget: Return an empty file [Solved]
        212624 by: Chris Blake

POST method to php page from php page
        212628 by: Bob Pilly
        212630 by: Aurélien Cabezon
        212631 by: M. Sokolewicz

XML Select
        212634 by: Stefan
        212636 by: Robinson, Matthew

Administrivia:

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

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

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
I would like to do the following:

============
mysql db:

andrew
anthony
joe
janice
john
simon
============

sql_query ( select names .....

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

I would need only the distinct first character from the query
result would be: a,j,s

I think maybe its REGEXP but never did it before...

Thanks!!

Andras Kende

--- End Message ---
--- Begin Message --- Andras Kende wrote:
I would like to do the following:

============
mysql db:

andrew
anthony
joe
janice
john
simon
============

sql_query ( select names .....

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

I would need only the distinct first character from the query
result would be: a,j,s

I think maybe its REGEXP but never did it before...

Thanks!!

Andras Kende


Try the query (no REGEXP):

SELECT DISTINCT SUBSTRING(names,0,1) FROM .....
--- End Message ---
--- Begin Message ---
Hello, 

i have a string looking like this.

 

## /T (KEY1)/V (VALUE1)|| ## /T (KEY2)/V (VALUE2)|| ## /V (VALUE3)/T
(KEY3)|| 

 

 

I know want to separete it in to keys and values and insert them into an
array.

Note that /T always shows that teh upcoming value in() is a Key and that /V
always is a Value. And that the set can be flipped.

 

Thank you very much for helping.

Mirco Blitz


--- End Message ---
--- Begin Message --- Webmaster wrote:
Hello,

i have a string looking like this.



## /T (KEY1)/V (VALUE1)|| ## /T (KEY2)/V (VALUE2)|| ## /V (VALUE3)/T
(KEY3)||






I know want to separete it in to keys and values and insert them into an
array.

Note that /T always shows that teh upcoming value in() is a Key and that /V
always is a Value. And that the set can be flipped.



Thank you very much for helping.

Mirco Blitz



It seems you complex yourself too much.. ;)

Try using regexp with the 'e' modifier:

<?php

$data="## /T (KEY1)/V (VALUE1)|| ## /T (KEY2)/V (VALUE2)|| ## /V (VALUE3)/T (KEY3)||";

$data_array=array();
preg_replace(
        array(
        "/\#\#\s*/T\s*\(([^\)]*)\)\s*\V\s*\(([^\)]*)\)\s*\|\|/e",
        "/\#\#\s*/V\s*\(([^\)]*)\)\s*\T\s*\(([^\)]*)\)\s*\|\|/e"
        ),
        array(
        "\$data_array['\\1']='\\2';",
        "\$data_array['\\2']='\\1';"
        ),
        $data
);

print_r($data_array);  //see if you get it as expected

?>

I believe there's an easier way to store your data as strings (like serialize), so why not using them?!
see alse: http://www.php.net/serialize

--- End Message ---
--- Begin Message --- Eli wrote:
Webmaster wrote:

Hello,
i have a string looking like this.



## /T (KEY1)/V (VALUE1)|| ## /T (KEY2)/V (VALUE2)|| ## /V (VALUE3)/T
(KEY3)||




I know want to separete it in to keys and values and insert them into an
array.

Note that /T always shows that teh upcoming value in() is a Key and that /V
always is a Value. And that the set can be flipped.




Thank you very much for helping.

Mirco Blitz



It seems you complex yourself too much.. ;)

Try using regexp with the 'e' modifier:

<?php

$data="## /T (KEY1)/V (VALUE1)|| ## /T (KEY2)/V (VALUE2)|| ## /V (VALUE3)/T (KEY3)||";

$data_array=array();
preg_replace(
    array(
    "/\#\#\s*/T\s*\(([^\)]*)\)\s*\V\s*\(([^\)]*)\)\s*\|\|/e",
    "/\#\#\s*/V\s*\(([^\)]*)\)\s*\T\s*\(([^\)]*)\)\s*\|\|/e"
    ),
    array(
    "\$data_array['\\1']='\\2';",
    "\$data_array['\\2']='\\1';"
    ),
    $data
);

print_r($data_array);  //see if you get it as expected

?>

I believe there's an easier way to store your data as strings (like serialize), so why not using them?!
see alse: http://www.php.net/serialize

Sorry... a little correction:

<?php

$data="## /T (KEY1)/V (VALUE1)|| ## /T (KEY2)/V (VALUE2)|| ## /V (VALUE3)/T (KEY3)||";

$data_array=array();
preg_replace(
    array(
    "/\#\#\s*\/T\s*\(([^\)]*)\)\s*\/V\s*\(([^\)]*)\)\s*\|\|/e",
    "/\#\#\s*\/V\s*\(([^\)]*)\)\s*\/T\s*\(([^\)]*)\)\s*\|\|/e"
    ),
    array(
    "\$data_array['\\1']='\\2';",
    "\$data_array['\\2']='\\1';"
    ),
    $data
);

print_r($data_array);  //see if you get it as expected

?>
--- End Message ---
--- Begin Message ---
On Thu, April 7, 2005 11:32 am, William Stokes said:
> Is there a way to limit a <textarea> size with som sort of a maxlength
> value
>
> I know it's not php but thanks anyway

There is no widely-supported HTML attribute for that for TEXTAREA (just
for INPUT).  Silly HTML.

You can write JavaScript to help nice users do that.  (Google for it)

But the mean users can bypass your JavaScript, so use PHP to be SURE it's
the right length.

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

--- End Message ---
--- Begin Message ---
Try this Forum: http://www.phpfreaks.com/forums/index.php?showforum=8

Hope this Helps!

Bruce wrote:
hi...

we're trying to find php developers/partners for a project, and we're
wondering if there are php user groups in the cali/bay area (san fran/san
jose) area that we can talk with, attend meetings, etc...

searching google didn't really turn up anything... we know that there are
some php job sites, but we didn't want to post there, given that this isn't
a 'salaried' opportunity. this would be strictly startup/sweat equity, ie..
risky as hell!!

thanks

bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Thu, April 7, 2005 11:23 am, Arshavir Grigorian said:
> I am getting 4-5 minute delays when I call the session_start() function
> in one of my scripts, I reduced it to a small script that just echoes
> some html, but still calling session_start() causes a major delay. My
> /tmp directory is almost empty and there is a lot of disk space. It's an
> AMD Athlon(TM) XP 3000+ with a Gig of RAM. Anyone knows what could cause
> this?

If user X with session Y is logging in from 2 different
computers/browsers/frames, then each HTTP interaction locks the session
while it's working on it...

So you end up with one or the other HTTP connections has to wait.

This may or may not have anything to do with your problem.

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

--- End Message ---
--- Begin Message ---
On Thu, April 7, 2005 11:54 am, cragland said:
> I've encountered the same problem with exec(curl, system(curl, etc.  PHP
> exits with sh: \curl: No file or directory.  I'm wondering if there is
> some php shell option that has to be set.

Use full path names for EVERYTHING in exec.

If curl, as I suspect, needs access to some kind of storage for .SSH keys,
Cookies, etc, then the PHP User needs that access.

Why not just use http://php.net/curl

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

--- End Message ---
--- Begin Message ---
Hey,
need some advise on what would be the best way to do this:

I have a table with these fields:
cno (just a auto_increment field),
username,
sex (2 values: man, woman),
has_pic (0=no,1=yes),
pic_name

I need to randomly get 3 womens pictures and one guys picture from the above
table...
I know I need to use rand() and i thought maybe shuffle() but am getting a
bit lost in the logic part...help please?

Thanks,
Ryan




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 4/6/2005

--- End Message ---
--- Begin Message ---

> why not do two select statements using the ORDER BY RAND() then append:
>
> LIMIT 3 for your women,
>
> and then
>
> LIMIT 1 for your men
>
>
>
> so the first one is:
>
> $result1 =
> mysql_query("select * from {table} where sex='female' order
> by rand() limit 3;");
>
> the second:
>
> $result2 =
> mysql_query("select * from {table} where sex='male' order
> by rand() limit 1;");
>
>
>
> where {table} is the name of your table...
>
>
>
> drew

Thanks Drew,

Simple solution to a simple problem.....guess I'm sitting on my brains right
now...or am just braindead.
Time for a break and guitar playing :-)

Cheers,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 4/6/2005

--- End Message ---
--- Begin Message ---
Team,

How do most of you get your clients, are their any other tricks besides word
of mouth.
I really want to become a freelance web designer, or work for a provider of
clients.
Also/or for a major coporation that.

Does anybody have any suggestions on how I can start getting paid for what I
know.
Yes I do realize I am talking to the competition... :-)

But any advise for a newbie would be greatly appreciated.

If you want you can email me directly at the url donw below.
Thank you very much in advance.


Karl James
(TheSaint)
[EMAIL PROTECTED]
http://theufl.com/
 

--- End Message ---
--- Begin Message --- I need to be able to store UTF-8 characters from a form into a MySQL table. But I need to support pre-UTF-8 MySQL (< 4.1).

So I'm converting UTF-8 characters into their numeric entities (e.g. ñ = &#241;).

The problem is that if the user enters a character that gets converted to an entity, the string might end up being longer than the field definition in the table allows.

For example, if I have a varchar(5) column and try to insert "señor" (which has been converted to "sen&#241;or"), I get "sen&#" in the table which is useless.

Has anyone dealt with this and if so how?

Thanks in advance for any advice, or pointers to any code that deals with this.
--- End Message ---
--- Begin Message --- C Drozdowski wrote:
I need to be able to store UTF-8 characters from a form into a MySQL table. But I need to support pre-UTF-8 MySQL (< 4.1).

So I'm converting UTF-8 characters into their numeric entities (e.g. ñ = &#241;).

The problem is that if the user enters a character that gets converted to an entity, the string might end up being longer than the field definition in the table allows.

For example, if I have a varchar(5) column and try to insert "señor" (which has been converted to "sen&#241;or"), I get "sen&#" in the table which is useless.

Has anyone dealt with this and if so how?

Thanks in advance for any advice, or pointers to any code that deals with this.

You first need to convert to binary charset, and then to the real charset. Do not convert from current charset to the real charset ahead, you may cause a data loss.
BEFORE converting - *backup* your databases !!!


http://dev.mysql.com/doc/mysql/en/charset-conversion.html
--- End Message ---
--- Begin Message ---
What do you want to do? for eg?


                                    Shi MuQi 
                      LangFang ABC (China)  °v° 
                      Tel:(86)-316-68382!^ /(_)\ 
              E-mail:[EMAIL PROTECTED] ^ ^ 


"William Stokes" <[EMAIL PROTECTED]> 写于 2005-04-08 01:23:39:

> Hello,

> This is not a php but sql question. My apologies but I don't know any 
good
> sql forums and I know that someone here might be able to answer.

> OK so the question is. How to make a SELECT query with WHERE definition 
that
> requires 2 conditions to be satisfied so that the row gets selected?

> MySQL manual says"where_definition consists of the keyword WHERE 
followed by
> an expression that indicates the condition or conditions that rows must
> satisfy to be selected"

> I just don't know how to write the query

> Thanks a lot
> -Will

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

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

It seems more like a problem in Perl than PHP.. so sorry if this is asked in the wrong list, but I believe there are also Perl gurus among the list members.. ;)

I have a perl script which from it I externally execute a PHP script with some parameters.
When running the perl program throu unix shell, then perl executes the PHP program as expected, and returns its output.
When running the perl program throu Apache (using cgi-bin on a browser), then perl opens the PHP file for reading and doesn't execute the PHP script, and returns the PHP code of the script.


The Perl line trying to execute the PHP script is:

open (PIPE,"./my_prog.php $arg1 $arg2 |");
while (<PIPE>)
  $res=$res.$_;
print "got:\n",$res;

Does anyone have any clue why Perl behaves differently on different enviorments?
OR: does anyone have a suggestion for a stable solution?


-thanks, Eli
--- End Message ---
--- Begin Message ---



Hi to all,
I'm a C++ programmer and I've to convert some simple classes
from C++ to PHP. My toolbar_button class must have two or more
constructors so I ask you if this is possible with PHP:

class toolbar_button
{
   CString m_name, m_tooltip, m_image, m_action;
   bool m_state, m_is_separator;

   toolbar_button(void) { /* my code here */ };
   toolbar_button(AnsiString name, bool state) { /* my code here */ };
   toolbar_button(toolbar_button *abutton) { /* my code here */ };

   ....
}

I'm using PHP 5.0.4 for Windows.
Thank you very much
Silverio

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:



Hi to all,
I'm a C++ programmer and I've to convert some simple classes
from C++ to PHP. My toolbar_button class must have two or more
constructors so I ask you if this is possible with PHP:


You can't overload a constructor, I mean a function in PHP. Maybe extending two classes from the base would be a good work-around.


Hope this helps,

--
Josip Dzolonga
http://josip.dotgeek.org

jdzolonga[at]gmail.com
--- End Message ---
--- Begin Message ---
Richard,

Thanks for the answer.
I understand that I can't do it the way I wanted .

I have changed my design.

Thanks ALL who answered.

-Saswat


On Apr 7, 2005 8:18 AM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Wed, April 6, 2005 10:07 am, Saswat Praharaj said:
> > I need some help in searching string in a file.
> >
> > My requirement is to search the string,append something to the string .
> > Write the string back to the file without changing other parts of the
> > file.
> >
> > e.g
> > Suppose I have the following string in a file
> >
> >
> > Set-Cookie: T_COOKIE=127.0.0.1-saswat-9; path=/
> >
> >
> > The fixed string is "Set-Cookie: T_COOKIE="and rest of the string is
> > variable.
> > I would like to change the string "127.0.0.1-saswat-9"  to say
> > "127.0.0.1-saswat-9-1234"
> 
> Problem is, that's *MORE* bytes than are already there.
> 
> You can't just smush a few more bytes in.
> 
> You will *HAVE* to write out a new file.
> 
> But you can read in only the first couple hundred bytes until you find
> your Set-Cookie: T_COOKIE, and then you write out the stuff before that,
> write out your new data, then read/write the whole rest of the file.
> 
> You may also want to consider using, say, awk or sed or whatever from
> http://php.net/exec -- I don't expect them to be that much faster than
> PHP, but what do I know?
> 
> > My constraint is : I don't want to read the whole file into a buffer
> > and work on that buffer as the file can be very large , sometimes more
> > than 10 mb.
> >
> > My advantage is : I know that I will get the search string in first
> > 200 bytes of the file , so I just need to read 200 bytes,play with
> > that and write it back (overwriting the first 200 bytes with new 200
> > some bytes) ..
> 
> If it's really 200 bytes for 200 bytes, yeah, fopen(..., 'r+') will work.
> 
> But if you can't squeeze your bytes into the same space as is already
> there, you can't do that.
> 
> You might also be able, for the future, to start using:
> 127.0.0.1-saswat-9-0000000 and then you'd be able to replace up to
> 99999999 and get back something you can easily read/write/format to be
> meaningful.
> 
> --
> Like Music?
> http://l-i-e.com/artists.htm
> 
>

--- End Message ---
--- Begin Message ---
i am developing a comment/discussion board and i want to display the results
in a threaded style. so far i have it all working except this one issue:

each row has an ID and a parentid, say i have 5 rows:

id : 10 most oranges come from florida
id : 16 ---- Re: most oranges come from florida (parentid 10)
id : 22 --------- Re: most oranges come from florida (parentid 16)
id : 24 --------- Re: most oranges come from florida (parentid 22)
id : 28 ---- Re: most oranges come from florida (parentid 16)

i want the rows to know the id directly above itself
so for example, row 5  (id 28) will some how know its parentid (16) is not
directly above it and is not accociated with the result its above (24)

i want to 'highlight' a row when the parent it belongs to is directly above
and do nothing if its not.

does this make any sense?
very confusing nonetheless. hope someone understands.

--- End Message ---
--- Begin Message --- Sebastian wrote:
i am developing a comment/discussion board and i want to display the results
in a threaded style. so far i have it all working except this one issue:

each row has an ID and a parentid, say i have 5 rows:

id : 10 most oranges come from florida
id : 16 ---- Re: most oranges come from florida (parentid 10)
id : 22 --------- Re: most oranges come from florida (parentid 16)
id : 24 --------- Re: most oranges come from florida (parentid 22)

the indentation in your example is off, 24 should be indented one more right?

id : 28 ---- Re: most oranges come from florida (parentid 16)

i want the rows to know the id directly above itself
so for example, row 5  (id 28) will some how know its parentid (16) is not
directly above it and is not accociated with the result its above (24)

yes, it will probably involve javascript. also rather than outputting table rows (belonging to a single table) think about outputting as nested DIVs (or ULs.)

<div>
id : 10 most oranges come from florida
    <div> 
    id : 16 ---- Re: most oranges come from florida (parentid 10)
        <div>
        id : 22 --------- Re: most oranges come from florida (parentid 16)
             <div>
             id : 24 -------------- Re: most oranges come from florida 
(parentid 22)
             </div>       
        id : 28 ---- Re: most oranges come from florida (parentid 16)   
        </div>
    </div>
</div>

such a setup would give you a very easy structure to grab/find parents using 
the DOM/javascript


i want to 'highlight' a row when the parent it belongs to is directly above and do nothing if its not.

does this make any sense?
very confusing nonetheless. hope someone understands.


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Sebastian [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 07, 2005 10:17 PM

> i want the rows to know the id directly above itself
> so for example, row 5  (id 28) will some how know its parentid (16) is not
> directly above it and is not accociated with the result its above (24)

Have a "ref" in the database, it refereres to the parent. If the ref is NULL, 
it´s the start thread

> i want to 'highlight' a row when the parent it belongs to is directly
> above
> and do nothing if its not.

Set $last_id = $id; in the end of the while and I the start of the while set: 
if($last_id == $ref) // highlight the line

Is that what You are looking for?

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

--- End Message ---
--- Begin Message ---
Greetings PHP(eople),

I have a wget process that runs to download a file from a web site,
however, if no file exists at the location I`m pulsing, how do I get it
to abort ?

Here is the code :

<?php
$getfile = 'wget -dv -o log.txt http://www.somesite.co.za/somefile.php';
$get = shell_exec($getfile);
?>

I looked at filesize(), but if no file is brought back then there is
nothing for the function to check.

If someone could point me to the right PHP function, or a link
somewhere...

Regards

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 782 0840
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

I have a very good DENTAL PLAN. Thank you.

--- End Message ---
--- Begin Message ---
Chris Blake wrote:

Greetings PHP(eople),

I have a wget process that runs to download a file from a web site,


Why would you do that ? There're bultin functions in PHP for doing it.

--
Josip Dzolonga
http://josip.dotgeek.org

jdzolonga[at]gmail.com
--- End Message ---
--- Begin Message ---
On Fri, 2005-04-08 at 13:52, Josip Dzolonga wrote:
> Chris Blake wrote:
> 
> >Greetings PHP(eople),
> >
> >I have a wget process that runs to download a file from a web site,
> >
> 
> Why would you do that ? There're bultin functions in PHP for doing it.

wget was the first thing I thought of  :)

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 782 0840
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

A woman was in love with fourteen soldiers. It was clearly platoonic.

--- End Message ---
--- Begin Message ---
Hello list,

I need to develop a multilingual web site and I am looking for the best way
of handling this task. There are three main issues I know:

1. Storing multilingual data in a database. Possible solutions I know:
a. many tables, one per each supported language, e.g. news_en, news_de.
b. one table having many columns with translations, e.g. (id, date, text_en,
text_de)
We use MySQL 4.1 as a back-end.

2. Multilingual HTML templates, possible solutions:
a. one generic template for everything, one per each language, like
contents_en.tpl.html, contents_de.tpl.html
b. many localized templates for each page, e.g news_en.tpl.html,
news_de.tpl.html
Template engine is Smarty.

3. Storing current language variable, possible solutions:
a. inside the URL like /en/news/
b. using cookies
c. using sessions
Web server is Apache2+mod_rewrite with PHP5

What are pros and cons for each solution? What are other possible solutions
for the above issues?

Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru

--- End Message ---
--- Begin Message --- Denis Gerasimov wrote:
Hello list,

I need to develop a multilingual web site and I am looking for the best way
of handling this task. There are three main issues I know:

1. Storing multilingual data in a database. Possible solutions I know:
a. many tables, one per each supported language, e.g. news_en, news_de.
b. one table having many columns with translations, e.g. (id, date, text_en,
text_de)
We use MySQL 4.1 as a back-end.

what about 1 table, 3 columns:

translatekey (varchar)          - string to translate
lang                            - lang code/id/name
translation  (varchar/text)     - translated string


2. Multilingual HTML templates, possible solutions: a. one generic template for everything, one per each language, like contents_en.tpl.html, contents_de.tpl.html b. many localized templates for each page, e.g news_en.tpl.html, news_de.tpl.html Template engine is Smarty.

using Smarty I sometimes assign an assoc array of translated strings:

$Lang['yes'] = 'yessiree';
$Lang['no']  = 'nocando';

then in Smarty:

<div class="LangExample">
'yes' is {$Lang.yes},
'no'  is {$Lang.no}
</div>


3. Storing current language variable, possible solutions: a. inside the URL like /en/news/

best in terms of SEO.

b. using cookies

handy for presistence.

c. using sessions

provides cleaner URLS.

I see no reason to do all 3.

Web server is Apache2+mod_rewrite with PHP5

What are pros and cons for each solution? What are other possible solutions
for the above issues?

Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru


--- End Message ---
--- Begin Message --- Denis Gerasimov wrote:
I need to develop a multilingual web site and I am looking for the best way
of handling this task. There are three main issues I know:

Mabye consider of using gettext.. http://www.php.net/gettext

BTW: why doesn't Smarty support gettext?
     How can gettext be implemented into Smarty (with simplier syntax)?

-thanks, Eli
--- End Message ---
--- Begin Message ---
On Fri, 2005-04-08 at 09:47, Chris Blake wrote:
> Greetings PHP(eople),
> 
> I have a wget process that runs to download a file from a web site,
> however, if no file exists at the location I`m pulsing, how do I get it
> to abort ?
> 
> Here is the code :
> 
> <?php
> $getfile = 'wget -dv -o log.txt http://www.somesite.co.za/somefile.php';
> $get = shell_exec($getfile);
> ?>
> 
> I looked at filesize(), but if no file is brought back then there is
> nothing for the function to check.
> 
> If someone could point me to the right PHP function, or a link
> somewhere...

No worries, file_exists() was what I was looking for.

Regards

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 782 0840
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

When managers hold endless meetings, the programmers write games. When
accountants talk of quarterly profits, the development budget is about
to be cut. When senior scientists talk blue sky, the clouds are about to
roll in. Truly, this is not the Tao of Programming. When managers make
commitments, game programs are ignored. When accountants make long-range
plans, harmony and order are about to be restored. When senior
scientists address the problems at hand, the problems will soon be
solved. Truly, this is the Tao of Programming. -- Geoffrey James, "The
Tao of Programming"

--- End Message ---
--- Begin Message ---
Hello all

Does anyone know if its possible to post data using the http POST method to another form using php?

I know its possible to use:

header( "Location: somelocation.php?" .SID&somevar=$somevar );

But this uses the GET method

any help or pointing me to any relevant documentation would be greatly appreciated.

Cheers

Bob
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bob Pilly wrote:
| Hello all

Hi,

| Does anyone know if its possible to post data using the http POST method
| to another form using php?
| I know its possible to use:
| header( "Location: somelocation.php?" .SID&somevar=$somevar );
| But this uses the GET method
| any help or pointing me to any relevant documentation would be greatly
| appreciated.

You can use Curl to post datas to a remote script.
http://www.php.net/curl

Regards,
Aurélien

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCVk1s2e0VO2fZtNYRAo/jAKC+rteA24gR9RvJSGu4VFm2F6btAQCfYvLT
cX6YCT49OEI+pR3iShAlk20=
=X2ll
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message --- Aurélien Cabezon wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bob Pilly wrote:
| Hello all

Hi,

| Does anyone know if its possible to post data using the http POST method
| to another form using php?
| I know its possible to use:
| header( "Location: somelocation.php?" .SID&somevar=$somevar );
| But this uses the GET method
| any help or pointing me to any relevant documentation would be greatly
| appreciated.

You can use Curl to post datas to a remote script.
http://www.php.net/curl

Regards,
Aurélien
also, I think Bob is a tad confused about what header does exactly. Because header() adds lines to the RESPONSE-header, not the REQUEST-header. The REQUEST header can send its request as a GET/POST/PUT/whatever, while the response header doesn't do anything even remotely like that. Basically, the 'Location'-response-header tells the browser that the file can be found at a different location, so the browser redirects there automatically. This is *not* a GET! Since you've added your query to the URL and browsers, by default, use the GET method of requesting data, the URL the browser will redirect to will be requested with the GET method, so it might seem asif you were using GET to request the page, for the browser, but in truth you don't have anything to day about it.

Now, what Aurélien is talking about, cURL, is the other end of the story. cURL can take on the role of both ends of the line, so it can send either the request, or the response. But, it will not send it to the user('s browser), but instead over a connection that it was told to send it over.

Basically, this means that you can't tell a browser it needs to do a POST request to another page via PHP. There :)

hope that helps you in understanding,
- tul

--- End Message ---
--- Begin Message ---
Hi NG
I've a question about searching in a xmlfile.
Is there a mehtod to select a xml-node with a specific value?

e.g.
<xml>
<name>abc</name>
<namedef</name>
</xml>

and I want search for the node with name abc.
Or is it possible with a xpath definition?

Thanks in advance
Stefan 

--- End Message ---
--- Begin Message ---
 There's a few xml -> array libraries out there which is probably the
easier way to examine xml stuff.

I use http://keithdevens.com/software/phpxml but there are many others.

M

-----Original Message-----
From: Stefan [mailto:[EMAIL PROTECTED] 
Sent: 08 April 2005 13:26
To: php-general@lists.php.net
Subject: [PHP] XML Select

Hi NG
I've a question about searching in a xmlfile.
Is there a mehtod to select a xml-node with a specific value?

e.g.
<xml>
<name>abc</name>
<namedef</name>
</xml>

and I want search for the node with name abc.
Or is it possible with a xpath definition?

Thanks in advance
Stefan 

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


_____________________________________________________________________
This message has been checked for all known viruses.



_____________________________________________________________________
This message has been checked for all known viruses.

--- End Message ---

Reply via email to