php-general Digest 27 Feb 2007 17:18:51 -0000 Issue 4649
Topics (messages 249476 through 249506):
Re: Array question
249476 by: Hap-Hang Yu
249483 by: Ford, Mike
249500 by: Gerry D
Array question - maybe UTF?
249477 by: Gerry D
$_SERVER["DOCUMENT_ROOT"] IIS6 windows2003
249478 by: Marco Sottana
get wikipedia content
249479 by: Marco Sottana
249481 by: Stut
Re: audio CAPTCHA - was Combining sound files
249480 by: Németh Zoltán
Cast to unset
249482 by: Robert Enyedi
249492 by: Robert Cummings
Populating array with function
249484 by: Dotan Cohen
249485 by: Brad Bonkoski
249486 by: Arpad Ray
249487 by: Dotan Cohen
249488 by: Dotan Cohen
249489 by: Dave Goodchild
249490 by: Jochem Maas
249491 by: Dotan Cohen
249498 by: Al
249499 by: Robert Cummings
PHP shell_exec
249493 by: h
249494 by: Németh Zoltán
249495 by: Andrei
249496 by: Peter Lauri
249503 by: Colin Guthrie
PHP Clustering System, beta testers
249497 by: Mark
USPS DPV & AMS Postal w/ PHP
249501 by: Chris Ditty
249502 by: Chris Ditty
249504 by: Chris Shiflett
249505 by: Chris Ditty
PHP 4.x for FC6
249506 by: edwardspl.ita.org.mo
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Try:
$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
$search = 'apple';
foreach($fruit as $key => $val) {
if ($val == $search) {
echo "$search found: array key is $key, value is $val";
}
}
2007/2/27, Gerry D <[EMAIL PROTECTED]>:
I have a question on how to retrieve the value that corresponds to a
key in an array.
$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
$key = array_search($c, $fruit);
if ( $key === FALSE )
$n = $c;
else
{
$n = $fruit[$key]; // how to get the value???
}
the array_search works ok, but how do I get the value?
all I get back is 'a' or 'b', not 'apple' or 'banana'...
TIA
Gerry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
--
Hap-Hang Yu, Jay
--- End Message ---
--- Begin Message ---
On 27 February 2007 04:23, Gerry D wrote:
> I have a question on how to retrieve the value that corresponds to a
> key in an array.
>
> $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
>
> $key = array_search($c, $fruit);
> if ( $key === FALSE )
> $n = $c;
> else
> {
> $n = $fruit[$key]; // how to get the value???
> }
>
> the array_search works ok, but how do I get the value?
>
> all I get back is 'a' or 'b', not 'apple' or 'banana'...
Please show a little more code, as it looks to me as though this should work
how you think it should.
Specifically: how do we know what is in $c? how do you know the array_search
works? how do you know $n is only getting 'a', 'b', or 'c'? (Hint: var_dump()
is your friend!)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--- End Message ---
--- Begin Message ---
Mike,
See entire function under topic "Array question - maybe UTF?"...
I am trying to change accented characters to their equivalent without accents.
And yes, the arrays look fine after var_dump()...
Gerry
On 2/27/07, Ford, Mike <[EMAIL PROTECTED]> wrote:
On 27 February 2007 04:23, Gerry D wrote:
> I have a question on how to retrieve the value that corresponds to a
> key in an array.
>
> $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
>
> $key = array_search($c, $fruit);
> if ( $key === FALSE )
> $n = $c;
> else
> {
> $n = $fruit[$key]; // how to get the value???
> }
>
> the array_search works ok, but how do I get the value?
>
> all I get back is 'a' or 'b', not 'apple' or 'banana'...
Please show a little more code, as it looks to me as though this should work
how you think it should.
Specifically: how do we know what is in $c? how do you know the array_search
works? how do you know $n is only getting 'a', 'b', or 'c'? (Hint: var_dump()
is your friend!)
--- End Message ---
--- Begin Message ---
Perhaps it's more a UTF8 issue that is going wrong for me.
At first strtr() was not giving me the results I wanted, so I started
tinkering. This is what I came up with... Still no satisfactory
results.
I think character support is rather lacking in php, or maybe I just
don't have a clue?
Gerry
function xlate_remove_accents( $string, $german=false, $output_array=false )
{
// Single letters
$single_fr = explode(" ", "À Á Â Ã Ä Å Ą Ă Ç Ć Č
Ď Đ Ð È É Ê Ë Ę Ě Ğ Ì Í Î Ï İ Ł
Ľ Ĺ Ñ Ń Ň Ò Ó Ô Õ Ö Ø Ő Ŕ Ř Š
Ś Ş Ť Ţ Ù Ú Û Ü Ů Ű Ý Ž Ź Ż à
á â ã ä å ą ă ç ć č ď đ è é ê ë ę
ě ğ ì í î ï ı ł ľ ĺ ñ ń ň ð ò
ó ô õ ö ø ő ŕ ř ś š ş ť ţ ù ú û ü
ů ű ý ÿ ž ź ż ™ (r)");
$single_to = explode(" ", "A A A A A A A A C C C D D D E E E E E E G
I I I I I L L L N N N O O O O O O O R R S S S T T U U U U U U Y Z Z Z
a a a a a a a a c c c d d e e e e e e g i i i i i l l l n n n o o o o
o o o o r r s s s t t u u u u u u y y z z z (tm) (r)");
$single = array();
for ($i=0; $i<count($single_fr); $i++)
{
$single[$single_fr[$i]] = $single_to[$i];
}
// Ligatures
$ligatures = array("Æ"=>"Ae", "æ"=>"ae", "Œ"=>"Oe", "œ"=>"oe",
"ß"=>"ss");
// German umlauts
$umlauts = array("Ä"=>"Ae", "ä"=>"ae", "Ö"=>"Oe", "ö"=>"oe",
"Ü"=>"Ue", "ü"=>"ue");
// Replace
$replacements = array_merge($single, $ligatures);
if ($german)
$replacements = array_merge($replacements, $umlauts);
if ( $output_array )
return( $replacements );
// $string = strtr($string, $replacements);
$n = '';
$s = str_split($string);
$l = strlen($string);
for ( $x = 0 ; $x < $l ; $x++ )
{
$c = $s[$x];
$newc = $c ;
foreach ( $replacements as $key => $val )
{
if ( $key == $c )
$newc = $val ;
}
$n .= $newc ;
}
return $n ;
}
On 2/26/07, Gerry D <[EMAIL PROTECTED]> wrote:
I was hoping for a function or something so I would not have to loop
through the array. Then again, I imagine search_array() does that
anyway...
Thanks for the quick reply!
Gerry
On 2/26/07, Hap-Hang Yu <[EMAIL PROTECTED]> wrote:
> Try:
>
> $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
> $search = 'apple';
>
> foreach($fruit as $key => $val) {
> if ($val == $search) {
> echo "$search found: array key is $key, value is $val";
> }
> }
>
> 2007/2/27, Gerry D <[EMAIL PROTECTED]>:
> > I have a question on how to retrieve the value that corresponds to a
> > key in an array.
> >
> > $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
> >
> > $key = array_search($c, $fruit);
> > if ( $key === FALSE )
> > $n = $c;
> > else
> > {
> > $n = $fruit[$key]; // how to get the value???
> > }
> >
> > the array_search works ok, but how do I get the value?
> >
> > all I get back is 'a' or 'b', not 'apple' or 'banana'...
> >
--- End Message ---
--- Begin Message ---
i have installed php in a IIS6 into a windows2003 i lost
$_SERVER["DOCUMENT_ROOT"]
why ??
--- End Message ---
--- Begin Message ---
anyone knows a script that can get wikipedia content in .php ?
--- End Message ---
--- Begin Message ---
Marco Sottana wrote:
anyone knows a script that can get wikipedia content in .php ?
The easiest way would be to download the DB and then build some PHP to
access it.
http://en.wikipedia.org/wiki/Wikipedia:Database_download
Make sure you read everything on that page, and make sure you follow
their rules.
-Stut
--- End Message ---
--- Begin Message ---
2007. 02. 26, hétfő keltezéssel 12.06-kor tedd ezt írta:
> Hi:
>
> Dumb error, please try again:
>
> http://www.sperling.com/a/c
>
> Plus, the point is to click the "Speak CAPTCHA" button and see if it speaks.
XP/IE7: the error message is gone, but button does nothing
Linux/Firefox: speak button redirects through s1.php-s5.php, they all
show the following error (or similar) :
Notice: Undefined index: captcha
in /home/httpd/vhosts/sperling.com/httpdocs/a/c/a.php on line 19
and Firefox tells me I need to install some missing plugin for the
content... (which may be true ;) )
greets
Zoltán Németh
>
> Thanks,
>
> tedd
>
>
> >I got the same notice on the top of the page.
> >besides that, when clicking the "speak captcha" button nothing happens
> >
> >greets
> >Zoltán Németh
> >
> >2007. 02. 26, hétf‘ keltezéssel 08.12-kor benifactor ezt írta:
> >> tried, and failed. got this error:
> >>
> >> Notice: Undefined variable: captcha in
> >> /home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29
> >>
> >> and no captcha was displayed.
> >> ----- Original Message -----
> >> From: "tedd" <[EMAIL PROTECTED]>
> >> To: <[email protected]>
> >> Sent: Monday, February 26, 2007 8:04 AM
> >> Subject: [PHP] audio CAPTCHA - was Combining sound files
> >>
> >>
> >> > Hi gang:
> >> >
> >> > Thanks for all the advice regarding combining sound files. I shall look
> >> > into all of it.
> >> >
> >> > In the meantime, I am trying a different solution and would appreciate
> >> > your review of the technique:
> >> >
> >> > http://www.sperling.com/a/c/
> >> >
> >> > The point of this experiment is to "speak" the numbers required for a
> >> > CAPTCHA protection scheme.
> >> >
> >> > I've had a few blind users report that this works for them, but
> >> > considering all the different platforms and talents on this list, I
> >> > thought that I would ask "Does this work (i.e., speak the numbers) for
> >> > you?" The numbers to be spoken are printed on the top of this page for
> >> > your notice.
> >> >
> >> > If you would be so kind, please review, provide me your platform type
> >> and
> >> > success.
> >> >
> >> > Thanks.
> >> >
> >> > tedd
> >> >
> >> > PS: What does this have to do with php? Well... a good deal of the code
> >> is
> >> > php and a mix of a bunch of other stuff (we don't live in a vacuum) --
> >> so
> >> > please permit me this indulgence.
> >> >
> >> > --
> >> > -------
> >> > http://sperling.com http://ancientstones.com http://earthstones.com
> >> >
> >> > --
> >> > 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
>
>
--- End Message ---
--- Begin Message ---
In the PHP grammar I encountered the feature of casting to unset, e.g.
(unset)$a. I did not manage to find any specific documentation on this,
only people wandering what it might do
(http://blog.thinkphp.de/archives/33-Casted-fun..html).
So what exactly does cast to unset do?
Thanks,
Robert
--- End Message ---
--- Begin Message ---
On Tue, 2007-02-27 at 11:36 +0200, Robert Enyedi wrote:
> In the PHP grammar I encountered the feature of casting to unset, e.g.
> (unset)$a. I did not manage to find any specific documentation on this,
> only people wandering what it might do
> (http://blog.thinkphp.de/archives/33-Casted-fun..html).
>
> So what exactly does cast to unset do?
Returns null.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
I need to populate an array with the contents of a directory. The
following code does not populate the $thumbnailFiles array like I
expect that it would:
<?php
function listFiles ($directory) {
$files=array();
$dir = dir($directory);
while ($entry = $dir->read()) {
if ( !is_dir($entry) ) {
$files[] = $entry;
print $entry."<br />"; // DEBUG CODE - REMOVE ME
}
}
$dir->close();
return $files;
}
$thumbnailsDirectory="/home/user/public_html/photostorage/160x120";
$lqDirectory="/home/user/public_html/photostorage/240x320";
$mqDirectory="/home/user/public_html/photostorage/800x600";
$hqDirectory="/home/user/public_html/photostorage/1600x1200";
$thumbnailFiles=array();
$lqFiles=array();
$mqFiles=array();
$hqFiles=array();
$thumbnailFiles=listFiles($thumbnailsDirectory);
print"<pre>";
print_r($thumbnailsFiles);
print"</pre>";
?>
The print statement does in fact print the files, so I know that I've
gotten _that_ far. How should I return the contents of $files to
$thumbnailFiles?
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/612/zion_i.html
http://what-is-what.com/what_is/php.html
--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
I need to populate an array with the contents of a directory. The
following code does not populate the $thumbnailFiles array like I
expect that it would:
<?php
function listFiles ($directory) {
$files=array();
$dir = dir($directory);
while ($entry = $dir->read()) {
if ( !is_dir($entry) ) {
$files[] = $entry;
perhaps look into the array_push() function http://www.php.net/array_push
print $entry."<br />"; // DEBUG CODE - REMOVE ME
}
}
$dir->close();
return $files;
}
$thumbnailsDirectory="/home/user/public_html/photostorage/160x120";
$lqDirectory="/home/user/public_html/photostorage/240x320";
$mqDirectory="/home/user/public_html/photostorage/800x600";
$hqDirectory="/home/user/public_html/photostorage/1600x1200";
$thumbnailFiles=array();
$lqFiles=array();
$mqFiles=array();
$hqFiles=array();
$thumbnailFiles=listFiles($thumbnailsDirectory);
print"<pre>";
print_r($thumbnailsFiles);
print"</pre>";
?>
The print statement does in fact print the files, so I know that I've
gotten _that_ far. How should I return the contents of $files to
$thumbnailFiles?
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/612/zion_i.html
http://what-is-what.com/what_is/php.html
--- End Message ---
--- Begin Message ---
Brad Bonkoski wrote:
$files[] = $entry;
perhaps look into the array_push() function http://www.php.net/array_push
$files[] = $entry; is perfectly fine.
$thumbnailFiles=listFiles($thumbnailsDirectory);
print"<pre>";
print_r($thumbnailsFiles);
print"</pre>";
The code is fine, spot the typo.
Arpad
--- End Message ---
--- Begin Message ---
On 27/02/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
perhaps look into the array_push() function http://www.php.net/array_push
Thanks, but I cannot use array_push() as I don't know the name of the
array that I'll be pushing to. There are four calls to the listFiles
function, and each will populate a different array.
Dotan Cohen
http://what-is-what.com/what_is/digg.html
http://english-lyrics.com
--- End Message ---
--- Begin Message ---
On 27/02/07, Arpad Ray <[EMAIL PROTECTED]> wrote:
The code is fine, spot the typo.
Ah! Found it!
$thumbnailFiles=listFiles($thumbnailsDirector
Should have been:
$thumbnailsFiles=listFiles($thumbnailsDirector
Thanks.
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/181/erasure.html
http://what-is-what.com/what_is/skype.html
--- End Message ---
--- Begin Message ---
You have a typo in your code...
--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
> On 27/02/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
>> perhaps look into the array_push() function http://www.php.net/array_push
>>
>
> Thanks, but I cannot use array_push() as I don't know the name of the
> array that I'll be pushing to. There are four calls to the listFiles
> function, and each will populate a different array.
the use of array_push() is not needed but the premise that it cannot
be used is wrong - the array inside the function is always called $files.
your problem is due to a simple typo, you could have checked the actual return
value of the function and seen that it does return the array:
var_dump( listFiles($thumbnailsDirectory) );
>
> Dotan Cohen
>
> http://what-is-what.com/what_is/digg.html
> http://english-lyrics.com
>
--- End Message ---
--- Begin Message ---
On 27/02/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
Dotan Cohen wrote:
> On 27/02/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
>> perhaps look into the array_push() function http://www.php.net/array_push
>>
>
> Thanks, but I cannot use array_push() as I don't know the name of the
> array that I'll be pushing to. There are four calls to the listFiles
> function, and each will populate a different array.
the use of array_push() is not needed but the premise that it cannot
be used is wrong - the array inside the function is always called $files.
your problem is due to a simple typo, you could have checked the actual return
value of the function and seen that it does return the array:
var_dump( listFiles($thumbnailsDirectory) );
That's what I was doing with this code:
print"<pre>";
print_r($thumbnailsFiles);
print"</pre>";
Thanks, all. Silly typo does it every time!
Dotan Cohen
http://what-is-what.com/what_is/xmp.html
http://lyricslist.com/lyrics/artist_albums/287/k_s_choice.html
--- End Message ---
--- Begin Message ---
A good php editor, with code completion, will help prevent this.
I like phpEdit. It even has a built-in syntax checker, which would have caught
your error immediately.
Dotan Cohen wrote:
On 27/02/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
Dotan Cohen wrote:
> On 27/02/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
>> perhaps look into the array_push() function
http://www.php.net/array_push
>>
>
> Thanks, but I cannot use array_push() as I don't know the name of the
> array that I'll be pushing to. There are four calls to the listFiles
> function, and each will populate a different array.
the use of array_push() is not needed but the premise that it cannot
be used is wrong - the array inside the function is always called $files.
your problem is due to a simple typo, you could have checked the
actual return
value of the function and seen that it does return the array:
var_dump( listFiles($thumbnailsDirectory) );
That's what I was doing with this code:
print"<pre>";
print_r($thumbnailsFiles);
print"</pre>";
Thanks, all. Silly typo does it every time!
Dotan Cohen
http://what-is-what.com/what_is/xmp.html
http://lyricslist.com/lyrics/artist_albums/287/k_s_choice.html
--- End Message ---
--- Begin Message ---
On Tue, 2007-02-27 at 09:05 -0500, Al wrote:
> A good php editor, with code completion, will help prevent this.
A decent brain with ample memory will suffice also. Upgrade packages not
available (yet) :)
Cheers,
Rob.
>
> I like phpEdit. It even has a built-in syntax checker, which would have
> caught
> your error immediately.
>
> Dotan Cohen wrote:
> > On 27/02/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
> >> Dotan Cohen wrote:
> >> > On 27/02/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
> >> >> perhaps look into the array_push() function
> >> http://www.php.net/array_push
> >> >>
> >> >
> >> > Thanks, but I cannot use array_push() as I don't know the name of the
> >> > array that I'll be pushing to. There are four calls to the listFiles
> >> > function, and each will populate a different array.
> >>
> >> the use of array_push() is not needed but the premise that it cannot
> >> be used is wrong - the array inside the function is always called $files.
> >>
> >> your problem is due to a simple typo, you could have checked the
> >> actual return
> >> value of the function and seen that it does return the array:
> >>
> >> var_dump( listFiles($thumbnailsDirectory) );
> >>
> >
> > That's what I was doing with this code:
> > print"<pre>";
> > print_r($thumbnailsFiles);
> > print"</pre>";
> >
> > Thanks, all. Silly typo does it every time!
> >
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Hi
I have been using the shell_exec command to perform several server queries
quite succesfully i.e. analysing files systems by gettin ginformation returned
by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to
target a command like this on another server?
So from server A where I am running a web app, needs to run the shell_exec('df
-kP') on server B, which also has php installed, so that i can display the
results in my web app on server A. Hope that makes sense!
Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A.
Any help greatly appreciated
Regards
Ade
--- End Message ---
--- Begin Message ---
2007. 02. 27, kedd keltezéssel 13.17-kor h ezt írta:
> Hi
>
> I have been using the shell_exec command to perform several server queries
> quite succesfully i.e. analysing files systems by gettin ginformation
> returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is
> possible to target a command like this on another server?
>
> So from server A where I am running a web app, needs to run the
> shell_exec('df -kP') on server B, which also has php installed, so that i can
> display the results in my web app on server A. Hope that makes sense!
>
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server
> A.
>
> Any help greatly appreciated
>
> Regards
>
> Ade
maybe you need ssh2_exec
http://hu.php.net/manual/hu/function.ssh2-exec.php
hope that helps
Zoltán Németh
--- End Message ---
--- Begin Message ---
Hi Ade,
Sure you can. You must develop 2 scripts. One that will act as
"server" and one as "client".
So if you want to get details of server B from server A you should
have the "server" into B and "client" into A.
Be sure the communication between these 2 servers is securised
(using a certificate or build you own encryption for communication,
restrict script response depending on server ips etc...) as you want to
pass sensitive data between them.
Communication can be done using curl library or simply with fopen
(if allow_url_fopen allows it). parameters can be passed using XML or
simple parsed plain text.
Andy
h wrote:
> Hi
>
>
>
> I have been using the shell_exec command to perform several server queries
> quite succesfully i.e. analysing files systems by gettin ginformation
> returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is
> possible to target a command like this on another server?
>
>
>
> So from server A where I am running a web app, needs to run the
> shell_exec('df -kP') on server B, which also has php installed, so that i can
> display the results in my web app on server A. Hope that makes sense!
>
>
>
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server
> A.
>
>
>
> Any help greatly appreciated
>
>
>
> Regards
>
>
>
> Ade
>
> .
>
>
--- End Message ---
--- Begin Message ---
ssh2_exec would do it for you...
Best regards,
Peter Lauri
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free
-----Original Message-----
From: h [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 27, 2007 3:18 PM
To: [email protected]
Subject: [PHP] PHP shell_exec
Hi
I have been using the shell_exec command to perform several server queries
quite succesfully i.e. analysing files systems by gettin ginformation
returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is
possible to target a command like this on another server?
So from server A where I am running a web app, needs to run the
shell_exec('df -kP') on server B, which also has php installed, so that i
can display the results in my web app on server A. Hope that makes sense!
Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server
A.
Any help greatly appreciated
Regards
Ade
--- End Message ---
--- Begin Message ---
h wrote:
> I have been using the shell_exec command to perform several server queries
> quite succesfully i.e. analysing files systems by gettin ginformation
> returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is
> possible to target a command like this on another server?
>
> So from server A where I am running a web app, needs to run the
> shell_exec('df -kP') on server B, which also has php installed, so that i can
> display the results in my web app on server A. Hope that makes sense!
>
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server
> A.
If you need to inspect e.g. free space on remote servers it may be more
sensible to use SNMP or some such similar protocol/system that is
designed for exactly this purpose rather than try to hack up a system in
PHP (tho' I do love my hacking!)
Have a look at Nagios. I'd imagine your servers will have some degree of
health monitoring/reporting installed anyway for your own peace of mind,
so it shouldn't be too hard to hook into that system.
Col
--- End Message ---
--- Begin Message ---
I have a PHP clustering back end server, MCache.
It is available in source form at http://www.mohawksoft.org
It allows multiple PHP web servers to share session information without any
changes to PHP code and without NFS or a database. It is based on a backend
server mcached and a PHP extension.
It is currently running on a couple websites and works successfully with
packages like Squirrelmail (which uses frames) and a few other roll your
own sites type things.
A technical discussion of why mcache is a good thing is here:
http://www.mohawksoft.org/?q=node/36
The "work in progress" user guide is here:
http://www.mohawksoft.org/?q=node/8
Any people willing to test would be appreciated, as would any suggestions on
how to improve the project.
I would be more than willing to help deploy this project on your site to get
feedback I can use to improve the project.
Thanks.
--- End Message ---
--- Begin Message ---
Has anyone ever used php to access the DPV and AMS Postal cds from the
USPS? If so, can you share any basic examples on how to get started
with it?
thanks
--- End Message ---
--- Begin Message ---
I'll check into them frowning on that. Currently, I just want to see
if I can do it.
Trust me, I am in NO way a competitor to you. :) I'm just a bored geek. :D
On 2/27/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> Hi Chris,
>
> From my understanding wouldn't the postal service frown upon that? I
> mean they don't even let you copy the data off the CD's onto your
> computer for faster access... Currently I just receive the Delivery
> Statistics Reports on CD. Will start receiving the DPV from my
> software company very shortly.
>
> Are you in the mailing industry? If so where? Want to make sure we
> aren't competitors ;)
>
>
>
>
>
> On Feb 27, 2007, at 10:17 AM, Chris Ditty wrote:
>
> > Has anyone ever used php to access the DPV and AMS Postal cds from the
> > USPS? If so, can you share any basic examples on how to get started
> > with it?
> >
> > thanks
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
>
> Jason Pruim
> [EMAIL PROTECTED]
> Production & Technology Manager
> MQC Specialist (2005 certified)
> 3251 132nd Ave
> Holland MI 49424
> 616.399.2355
> www.raoset.com
>
>
> "America will never be destroyed from the outside. If we falter and lose
> our freedoms, it will be because we destroyed ourselves."
> -Abraham Lincoln
>
>
>
>
--- End Message ---
--- Begin Message ---
Chris Ditty wrote:
> Has anyone ever used php to access the DPV and AMS Postal cds
> from the USPS? If so, can you share any basic examples on how
> to get started with it?
Andrew and Randy (two previous AME leads) started a project a while ago
called phpZ4:
http://sf.net/projects/phpz4/
I'd contact them to see what they recommend.
Chris
--
Chris Shiflett
http://shiflett.org/
--- End Message ---
--- Begin Message ---
Thanks Chris. I was thinking that Randy did something like that. I
was planning on calling him for the project name.
On 2/27/07, Chris Shiflett <[EMAIL PROTECTED]> wrote:
Chris Ditty wrote:
> Has anyone ever used php to access the DPV and AMS Postal cds
> from the USPS? If so, can you share any basic examples on how
> to get started with it?
Andrew and Randy (two previous AME leads) started a project a while ago
called phpZ4:
http://sf.net/projects/phpz4/
I'd contact them to see what they recommend.
Chris
--
Chris Shiflett
http://shiflett.org/
--- End Message ---
--- Begin Message ---
Dear All,
Is there php 4.x ( rpm packages ) for Linux FC6 System ?
Due to our php programs they seem not compatable with php 5...
Edward.
--- End Message ---