php-general Digest 28 Sep 2004 13:49:17 -0000 Issue 3022

Topics (messages 198036 through 198063):

Re: problem with file upload script
        198036 by: raditha dissanayake
        198037 by: AMC

Re: Mass Mailing Using PHP
        198038 by: Manuel Lemos
        198043 by: Roger Thomas

submit to a remote form without the use of curl?? Is it possible?
        198039 by: bclem.imaginative-enterprises.com
        198040 by: raditha dissanayake
        198041 by: Curt Zirzow
        198042 by: Chris Shiflett
        198061 by: Brent Clements

Shell command in php script
        198044 by: Vincent FONTENEAU
        198045 by: M. Sokolewicz

grabbing information from websites
        198046 by: champinoamn
        198047 by: M. Sokolewicz
        198049 by: champinoamn
        198050 by: champinoamn
        198051 by: Graham Cossey
        198053 by: champinoamn
        198054 by: M. Sokolewicz
        198055 by: M. Sokolewicz
        198063 by: champinoamn

How can I formated a PHP script into colored HTML
        198048 by: shimuqiiheb.abchina.com
        198060 by: Jason Wong

Need help in implementing Payment Gatewaydetails
        198052 by: suneel
        198062 by: Burhan Khalid

Re: how to execute a remote command from php [done]
        198056 by: Victor Alvarez

Re: Website with a Instant Messenger
        198057 by: Ricardo Cezar
        198058 by: Robert Sossomon

Re: Testing Response of A Proxy with PHP?
        198059 by: Nick Wilson

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 ---
AMC wrote:

Hi,

I changed the script to upload to a different directory but it still doesn't
work, any ideas? I really appreciate the help.


You are not the first person to run into problems with file uploads. Quite a few of those who managed to overcome them posted their finding at the link that Jay has sent. It seems obvious that you have not read it.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---
--- Begin Message ---
I did read this and it did not resolve the problem

"Raditha Dissanayake" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> AMC wrote:
>
> >Hi,
> >
> >I changed the script to upload to a different directory but it still
doesn't
> >work, any ideas?  I really appreciate the help.
> >
> >
> You are not the first person to run into problems with file uploads.
> Quite a few of those who managed to overcome them posted their finding
> at the link that Jay has sent. It seems obvious that you have not read it.
>
> -- 
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 128 KB | with progress bar.

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

On 09/27/2004 09:02 PM, Roger Thomas wrote:
Just let me know which OS and local mailer (Sendmail, qmail, postfix, exim, MS IIS, Exchange, etc..) do you use so I can advise.


What do you recommend for Linux and qmail combination ?
Please advise.

Under Linux qmail or postfix are just fine. You can use the mail function and it will use qmail. You may just need to tune qmail to maximize the number of simultaneous deliveries according to the available bandwidth.


Just keep in mind that qmail will queue every message that it receives, either from local clients or incoming via SMTP. This means that your incoming and outgoing messages will compete in the same queue. If you have urgent messages to send or receive, these may be delayed during deliveries to many recipients.

For this reason, during deliveries of messages to many recipients, it is better to pause once in a while to let the queue be fully processed and do not stall other programs.

--

Regards,
Manuel Lemos

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

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

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

--- End Message ---
--- Begin Message ---
Quoting Manuel Lemos <[EMAIL PROTECTED]>:

> You may just need to tune qmail to maximize the number of simultaneous deliveries 
> according to the available bandwidth.

How do I tune qmail in that manner ? If the answer is too long and complicated, pls 
flame me softly as this is already OT.
 
> For this reason, during deliveries of messages to many recipients, it is better to 
> pause once in a while to let the queue be fully processed and do not stall other 
> programs.

Do you mean, say we fetched 100,000 addresses from database, we make our script sleep 
for a while after sending, say 1000 mails ?

--
roger


---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

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

Is it possible with php to submit to a remote form without the use of curl?

I am developing an application on a hosting server that does not have curl
available and I need to submit some values to a remote form.

Anybody ever do something like this without the use of curl?

Thanks,
Brent

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

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

Is it possible with php to submit to a remote form without the use of curl?

I am developing an application on a hosting server that does not have curl
available and I need to submit some values to a remote form.

Anybody ever do something like this without the use of curl?


It's quite possible you can use fsockopen() to do this manually (RFC 2616) or you can make use of any of the classes available for free.
in some platforms you might find the POST binary which makes things a lot easier.



Thanks,
Brent

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---
--- Begin Message ---
* Thus wrote [EMAIL PROTECTED]:
> 
> 
> Is it possible with php to submit to a remote form without the use of curl?

I'm assuming you want to POST a form verses a GET, since you can
easily do a GET form submission like:

  $fp = fopen('http://domain.com/?get=var', 'r');

in PHP5 you can accomplish this using the new zcontext parameter:

$postdata = 'foo=bar';
$contextConf = array(
  'http' => array (
    'method' => 'POST',
    'header' => "Content-Length: " . strlen($postdata) . "\r\n",
    'content' => $postdata
  ),
);

$zcontext = stream_context_create($contextConf);
$fp = fopen('http://domain.com/', 'r', $zcontext);


Curt
-- 
The above comments may offend you. flame at will.

--- End Message ---
--- Begin Message ---
--- [EMAIL PROTECTED] wrote:
> Is it possible with php to submit to a remote form without the
> use of curl?

You can use fsockopen:

http://shiflett.org/hacks/php/http_post

If your version of PHP supports streams, you can use streams:

http://shiflett.org/hacks/php/streams_post

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
Coming December 2004        http://httphandbook.org/

--- End Message ---
--- Begin Message ---
Stupid me completely forgot about the socket functions in PHP. Again, that's
what I get for having too little coffee last night.

Thanks for the help everyone.

----- Original Message ----- 
From: "Chris Shiflett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, September 27, 2004 11:06 PM
Subject: Re: [PHP] submit to a remote form without the use of curl?? Is it
possible?


> --- [EMAIL PROTECTED] wrote:
> > Is it possible with php to submit to a remote form without the
> > use of curl?
>
> You can use fsockopen:
>
> http://shiflett.org/hacks/php/http_post
>
> If your version of PHP supports streams, you can use streams:
>
> http://shiflett.org/hacks/php/streams_post
>
> Hope that helps.
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
> Coming December 2004        http://httphandbook.org/

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

I'm trying to find how to execute a shell command in a php script, I
meen I would like for example to stop services like ssh or others in
/etc/init.d with command stop and start it again.

I've tried some commands without success, and I've missed something like
script owner or group. I really don't know. Perhaps it sould be in php
conf ?

Is someone have any idea ?

Thanks

Vincent

--- End Message ---
--- Begin Message --- Vincent Fonteneau wrote:
Hi,

I'm trying to find how to execute a shell command in a php script, I
meen I would like for example to stop services like ssh or others in
/etc/init.d with command stop and start it again.

I've tried some commands without success, and I've missed something like
script owner or group. I really don't know. Perhaps it sould be in php
conf ?

Is someone have any idea ?

Thanks

Vincent
use one of these
<?php
shell_exec('cmd');
exec('cmd');    // synonim to `cmd`
?>
there a few more... but I can't remember which

--- End Message ---
--- Begin Message ---
hi everyone,
im fairly new to php scripting and was having trouble grabing information 
from a website.
i have been able to grab information that is in amongst other text (for 
example, the word firemaking below)

-------

<td><a href="hiscoreuser.cgi?username=champinoman&category=12" 
class=c>Firemaking</a></td>
<td align="right">7,386</td><td align="right">
61
</td><td align="right">
333,575
</td></tr>

-------

but the number i want to grab is the 61. its on its own line which i think 
is the reason im having trouble.
i have been using this:

eregi 
("username=champinoman&category=13.*align=\"right\">(.*)</td>",$line,$out)

what am i doing wrong? have i posted enough information.

thank you for the help.

p.s. try and keep the answers fairly straight forward as i am new to this 

--- End Message ---
--- Begin Message ---
Champinoamn wrote:

hi everyone,
im fairly new to php scripting and was having trouble grabing information from a website.
i have been able to grab information that is in amongst other text (for example, the word firemaking below)


-------

<td><a href="hiscoreuser.cgi?username=champinoman&category=12" class=c>Firemaking</a></td>
<td align="right">7,386</td><td align="right">
61
</td><td align="right">
333,575
</td></tr>


-------

but the number i want to grab is the 61. its on its own line which i think is the reason im having trouble.
i have been using this:


eregi ("username=champinoman&category=13.*align=\"right\">(.*)</td>",$line,$out)

what am i doing wrong? have i posted enough information.

thank you for the help.

p.s. try and keep the answers fairly straight forward as i am new to this
instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines .
--- End Message ---
--- Begin Message ---
> instead of the POSIX regexp, tr using PERL style RegExps
> (www.php.net/pcre) Once you've done that, you can add the pattern modifier 
> 'm' to allow multilines .

i think im lost now. i had a look at the site but im not sure what im 
looking at. any chance u could make a mock script up so i can see what your 
explaining? 

--- End Message ---
--- Begin Message ---
where abouts am i putting the modifier 'm' in the expression to allow the 
multilines?


"Champinoman" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
>> instead of the POSIX regexp, tr using PERL style RegExps
>> (www.php.net/pcre) Once you've done that, you can add the pattern 
>> modifier 'm' to allow multilines .
>
> i think im lost now. i had a look at the site but im not sure what im 
> looking at. any chance u could make a mock script up so i can see what 
> your explaining? 

--- End Message ---
--- Begin Message ---
>From http://gnosis.cx/publish/programming/regular_expressions.html:

"Sometimes you have a programming problem and it seems like the best
solution is to use regular expressions; now you have two problems."

To me regular expressions are some kind of black art, I've been programming
for 20 years and until recently have pretty much managed to avoid them. The
above URL is a pretty good tutorial.

HTH

Graham

-----Original Message-----
From: champinoman [mailto:[EMAIL PROTECTED]
Sent: 28 September 2004 09:35
To: [EMAIL PROTECTED]
Subject: [PHP] Re: grabbing information from websites



> instead of the POSIX regexp, tr using PERL style RegExps
> (www.php.net/pcre) Once you've done that, you can add the pattern modifier
> 'm' to allow multilines .

i think im lost now. i had a look at the site but im not sure what im
looking at. any chance u could make a mock script up so i can see what your
explaining?

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

--- End Message ---
--- Begin Message ---
so does this look right:

eregi 
("username=champinoman&category=13.*align=\"right\">(.*)</td>"m,$line,$out))

is that where i am ment to put the 'm' modifier? or am i still off on the 
wrong track?




"Graham Cossey" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> From http://gnosis.cx/publish/programming/regular_expressions.html:
>
> "Sometimes you have a programming problem and it seems like the best
> solution is to use regular expressions; now you have two problems."
>
> To me regular expressions are some kind of black art, I've been 
> programming
> for 20 years and until recently have pretty much managed to avoid them. 
> The
> above URL is a pretty good tutorial.
>
> HTH
>
> Graham
>
> -----Original Message-----
> From: champinoman [mailto:[EMAIL PROTECTED]
> Sent: 28 September 2004 09:35
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: grabbing information from websites
>
>
>
>> instead of the POSIX regexp, tr using PERL style RegExps
>> (www.php.net/pcre) Once you've done that, you can add the pattern 
>> modifier
>> 'm' to allow multilines .
>
> i think im lost now. i had a look at the site but im not sure what im
> looking at. any chance u could make a mock script up so i can see what 
> your
> explaining?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 

--- End Message ---
--- Begin Message --- I thought I clearly stated that for the m modifier you need to use PCRE functions!

eg:

preg_match('/username=champinoman&category=13.*align="right">(.*)</td>/mi', $text, $out);

Champinoman wrote:
so does this look right:

eregi ("username=champinoman&category=13.*align=\"right\">(.*)</td>"m,$line,$out))

is that where i am ment to put the 'm' modifier? or am i still off on the wrong track?




"Graham Cossey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]


From http://gnosis.cx/publish/programming/regular_expressions.html:

"Sometimes you have a programming problem and it seems like the best
solution is to use regular expressions; now you have two problems."

To me regular expressions are some kind of black art, I've been programming
for 20 years and until recently have pretty much managed to avoid them. The
above URL is a pretty good tutorial.


HTH

Graham

-----Original Message-----
From: champinoman [mailto:[EMAIL PROTECTED]
Sent: 28 September 2004 09:35
To: [EMAIL PROTECTED]
Subject: [PHP] Re: grabbing information from websites




instead of the POSIX regexp, tr using PERL style RegExps
(www.php.net/pcre) Once you've done that, you can add the pattern modifier
'm' to allow multilines .

i think im lost now. i had a look at the site but im not sure what im
looking at. any chance u could make a mock script up so i can see what your
explaining?


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

--- End Message ---
--- Begin Message ---
ugh, obviously I'm a bad typer :) The code should be:

preg_match('#username=champinoman&category=13.*align="right">(.*)</td>#mi', $text, $out);

Or using any other patterndelimiter... ;)

M. Sokolewicz wrote:

I thought I clearly stated that for the m modifier you need to use PCRE functions!

eg:

preg_match('/username=champinoman&category=13.*align="right">(.*)</td>/mi', $text, $out);

Champinoman wrote:

so does this look right:

eregi ("username=champinoman&category=13.*align=\"right\">(.*)</td>"m,$line,$out))


is that where i am ment to put the 'm' modifier? or am i still off on the wrong track?





"Graham Cossey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]


From http://gnosis.cx/publish/programming/regular_expressions.html:

"Sometimes you have a programming problem and it seems like the best
solution is to use regular expressions; now you have two problems."

To me regular expressions are some kind of black art, I've been programming
for 20 years and until recently have pretty much managed to avoid them. The
above URL is a pretty good tutorial.


HTH

Graham

-----Original Message-----
From: champinoman [mailto:[EMAIL PROTECTED]
Sent: 28 September 2004 09:35
To: [EMAIL PROTECTED]
Subject: [PHP] Re: grabbing information from websites




instead of the POSIX regexp, tr using PERL style RegExps
(www.php.net/pcre) Once you've done that, you can add the pattern modifier
'm' to allow multilines .


i think im lost now. i had a look at the site but im not sure what im
looking at. any chance u could make a mock script up so i can see what your
explaining?


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

--- End Message ---
--- Begin Message ---
i said i was learning this and didnt really understand it.
so going by what has been said i have come up with the following.... but 
still doesnt want to work.
heres what i have:

<?php
$file = fopen 
("http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=champinoman","r";);
$line = fgets ($file, 1024);
if 
(preg_match('#username=champinoman&category=13.*align="right">(.*)</td>#mi',$line,$out))
 
{
$rune = $out;
}
fclose($file);
print $rune;
?>

and the source it is looking at is:

<tr><td><img src="http://www.runescape.com/img/hiscores/crafting.gif"; 
valign="bottom" width=16 height=16 /></td><td>&nbsp;</td>
<td><a href="hiscoreuser.cgi?username=champinoman&category=13" 
class=c>Crafting</a></td>
<td align="right">70,277</td><td align="right">
43
</td><td align="right">
53,630
</td></tr>

I want it to get the 70,277 and store as $rune
if someone can tell me where im wrong i would be extremely grateful

thank you for your ongoing support.



----------------------------------------------------------------------------------------------
"M. Sokolewicz" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> ugh, obviously I'm a bad typer :) The code should be:
>
> preg_match('#username=champinoman&category=13.*align="right">(.*)</td>#mi', 
> $text, $out);
>
> Or using any other patterndelimiter... ;)
>
> M. Sokolewicz wrote:
>
>> I thought I clearly stated that for the m modifier you need to use PCRE 
>> functions!
>>
>> eg:
>>
>> preg_match('/username=champinoman&category=13.*align="right">(.*)</td>/mi', 
>> $text, $out);
>>
>> Champinoman wrote:
>>
>>> so does this look right:
>>>
>>> eregi 
>>> ("username=champinoman&category=13.*align=\"right\">(.*)</td>"m,$line,$out))
>>>
>>> is that where i am ment to put the 'm' modifier? or am i still off on 
>>> the wrong track?
>>>
>>>
>>>
>>>
>>> "Graham Cossey" <[EMAIL PROTECTED]> wrote in message 
>>> news:[EMAIL PROTECTED]
>>>
>>>> From http://gnosis.cx/publish/programming/regular_expressions.html:
>>>>
>>>> "Sometimes you have a programming problem and it seems like the best
>>>> solution is to use regular expressions; now you have two problems."
>>>>
>>>> To me regular expressions are some kind of black art, I've been 
>>>> programming
>>>> for 20 years and until recently have pretty much managed to avoid them. 
>>>> The
>>>> above URL is a pretty good tutorial.
>>>>
>>>> HTH
>>>>
>>>> Graham
>>>>
>>>> -----Original Message-----
>>>> From: champinoman [mailto:[EMAIL PROTECTED]
>>>> Sent: 28 September 2004 09:35
>>>> To: [EMAIL PROTECTED]
>>>> Subject: [PHP] Re: grabbing information from websites
>>>>
>>>>
>>>>
>>>>
>>>>> instead of the POSIX regexp, tr using PERL style RegExps
>>>>> (www.php.net/pcre) Once you've done that, you can add the pattern 
>>>>> modifier
>>>>> 'm' to allow multilines .
>>>>
>>>>
>>>> i think im lost now. i had a look at the site but im not sure what im
>>>> looking at. any chance u could make a mock script up so i can see what 
>>>> your
>>>> explaining?
>>>>
>>>> -- 
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php 



--- End Message ---
--- Begin Message ---
Hi!

How can I make a code into html format like this







<?php
$foo = "5bar"; // string
$bar = true;   // boolean

settype($foo, "integer"); // $foo 现在是 5   (integer)
settype($bar, "string");  // $bar 现在是 "1" (string)
?> 



<TABLE  BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR  ><TD  ><code 
><font  color="#000000">
<font  color="#0000BB">&lt;?php<br  />$foo </font><font  color="#007700">= 
</font><font  color="#DD0000">"5bar"</font><font  color="#007700">; 
</font><font  color="#FF8000">// string<br  /></font><font 
color="#0000BB">$bar </font><font  color="#007700">= </font><font 
color="#0000BB">true</font><font 
color="#007700">;&nbsp;&nbsp;&nbsp;</font><font  color="#FF8000">// 
boolean<br  /><br  /></font><font  color="#0000BB">settype</font><font 
color="#007700">(</font><font  color="#0000BB">$foo</font><font 
color="#007700">, </font><font  color="#DD0000">"integer"</font><font 
color="#007700">); </font><font  color="#FF8000">// $foo 现在是 
5&nbsp;&nbsp;&nbsp;(integer)<br  /></font><font 
color="#0000BB">settype</font><font  color="#007700">(</font><font 
color="#0000BB">$bar</font><font  color="#007700">, </font><font 
color="#DD0000">"string"</font><font 
color="#007700">);&nbsp;&nbsp;</font><font  color="#FF8000">// $bar 现在是 
"1" (string)<br  /></font><font  color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE>

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


--- End Message ---
--- Begin Message ---
On Tuesday 28 September 2004 12:40, [EMAIL PROTECTED] wrote:

> How can I make a code into html format like this

You can have a look at the highlight_file() function.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Women, deceived by men, want to marry them; it is a kind of revenge
as good as any other.
                -- Philippe De Remi
*/

--- End Message ---
--- Begin Message ---
Hi.....
        Any one could tell me about how to implement VeriSign Payment
Gateway.

    I mean I want to know how to implement the AVS and CSC filter settings
in test mode and how to convert them in to live mode. Its Very Important

Thanks in advance...

--- End Message ---
--- Begin Message --- suneel wrote:
Hi.....
        Any one could tell me about how to implement VeriSign Payment
Gateway.

    I mean I want to know how to implement the AVS and CSC filter settings
in test mode and how to convert them in to live mode. Its Very Important

Thanks in advance...

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

The rest you can get from Verisign.
--- End Message ---
--- Begin Message ---
----- Original Message ----- 
From: "Sethi, Samir (IDS DM&DS)" <[EMAIL PROTECTED]>
To: "Victor Alvarez" <[EMAIL PROTECTED]>
Sent: Monday, September 27, 2004 5:47 PM
Subject: RE: [PHP] how to execute a remote command from php



Exactly, I had to generate keys for nobody and now I am able to execute
remote commands.

Thank you so much.
 Victor.




I think when you execute the command it is run as user nobody. You may
need to generate keys for the
nobody account and update the authorized keys on the remote system.

Samir.


-----Original Message-----
From: Victor Alvarez [mailto:[EMAIL PROTECTED]
Sent: Monday, September 27, 2004 12:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] how to execute a remote command from php


Hello,
 Since last week I am trying  to execute a remote machine command from
php without success. Since ssh ask for a password, I managed to use ssh
with dsa authentication so it's possible to call the remote command
without password and only with one line: ssh -l victor 192.168.129.211
-i /root/.ssh/id_dsa "whoami". It works perfectly from command line but
I have nothing if I try to do the same from php: exec("ssh -l victor
192.168.129.211 -i /root/.ssh/id_dsa \"whoami\"",$results); $results is
empty after the execution.

I wonder if somebody could answer this question. I have found no
solution googling it.

Thank you.
Regards,
 Victor.
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain
or redistribute it. Click here for important additional terms relating to
this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

--- End Message ---
--- Begin Message ---
"Raditha Dissanayake" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
> Ricardo Cezar wrote:
>
> >Hello all,
> >
> >I want to put a instant messenger in a website. People connect to this
> >website to stay in touch with each other. There is a photo album for
> >everyone, a Forum, groups...
> >
> >The IM must work like ICQ, MSN and other, but via web. Users of the site
can
> >add other users to the list, and when people log in their status go
ONLINE.
> >Then we can open another window and chat, or send a message...


> Strange as it may seem. This is not asking too much. Jabber
> (http://www.jabber.org) can do all that. You will even find a couple of
> PHP classes to talk to a jabber server.
>
> Raditha Dissanayake.


Thanks Raditha. I will look jabber.org for some docs. :)


--- End Message ---
--- Begin Message ---
Use jabber.

They had a web interface over a year ago, and it can be tweaked to operate with or without a locked down registration form.

I had some scripts at my old job to handle just this very thing, but alas I did not get a chance to copy them before I left. It's pretty straight forward and jabber is trifling easy to get set up and running, especially on a RH system.

Robert

Ricardo Cezar wrote:

Well, I think everybody starts there, including me! :)
I�m searching google...

But thanks
:)



"Jay Blanchard" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
[snip]
Where can I start?
[/snip]

http://www.google.com




-- Robert Sossomon, Webmaster and IT Guru 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
* and then Marek Kilimajer declared....
> >oookay... i think i understand the page, but how would i imlement that
> 
> $fp = fsockopen ("proxy.server.net", 8080, $errno, $errstr, 30);
> if (!$fp) {
>     echo "$errstr ($errno)<br>\n";
> } else {
>     fputs ($fp, "OPTIONS * HTTP/1.0\r\nMax-Forwards: 0\r\n\r\n");
>     while (!feof($fp)) {
>         echo fgets ($fp,128);
>     }
>     fclose ($fp);
> }
> 
> You should get something like:
> 
> HTTP/1.0 200 Ok
> Date: Sun, 26 Sep 2004 20:48:46 GMT
> Via: HTTP/1.1 proxy.server.net (Traffic-Server/4.0.18 [c s f ])
> Allow: CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PURGE, PUT, PUSH, TRACE
> Content-Length: 0

Well, it connects great! However, i get errors back about * being a bad
url...?

-- 
Nick W

--- End Message ---

Reply via email to