php-general Digest 27 Jan 2006 17:18:06 -0000 Issue 3930

Topics (messages 229357 through 229370):

Re: copy problem with HTTP wrapper
        229357 by: Laurent Vanstaen
        229362 by: Manuel Lemos
        229363 by: Laurent Vanstaen
        229364 by: Manuel Lemos
        229365 by: David Grant
        229366 by: Laurent Vanstaen
        229367 by: David Grant
        229368 by: Laurent Vanstaen

Re: [SOLVED] Re: usr VAR value as a VAR Name
        229358 by: Barry

Re: Does file_exists() 'honour' open_basedir?
        229359 by: DRYALLS
        229360 by: David Grant
        229361 by: David Grant

PHP Job opening in UK, London
        229369 by: Chris Boget

doubt regarding while loop
        229370 by: suresh kumar

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 ---

> Hi all,
>   I'm trying to copy a file from my PHP server to another server (a
> home
> gateway, called a LiveBox). I've used this code :
>
> $livebox = "192.168.1.1";
> ...
> ...
> ...
> $crontab_livebox = "http://".$livebox."/cgi-bin/newCrontab";;
> if (!copy($crontab_temp_name, $crontab_livebox)) {
>    echo "<br />Impossible to copy the temp crontab file to the
> Livebox.<br
> />";
> }
>
> I get the following error :
> "HTTP wrapper does not support writeable connections"
>
> OK can I solve this. Can't I use URLs with the "copy" function if they
> don't
> point to my PHP server (local URLs) ? How can I copy a file from my
> PHP
> server to another server (there's no FTP server on the destination
> machine)
> ?

Put it this way:
If what you typed above *DID* work, what's to stop *ME* from copying
whatever I want onto your server?...

I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean.


You probably need to use cURL to login to your livebox, and then POST
the data into the newCrontab form handler.


OK I'm gonna look for information about that.

Thank you,

Laurent

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

on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
> I see your point. Here in my case the server I want to copy a file on
> has 192.168.1.1 for IP address and thus cannot be found from outside a
> LAN, so the security problem is not that much important. But I agree
> with you and see what you mean.

You may want to try sending files via form upload. Then on the
destination end the you could have a PHP script that would take care of
authentication and receiving and storing the uploaded files.

In that case you may want to try this HTTP client class. It can act as a
normal browser submitting files via POST and also authentication, cookie
handling and redirection in case you want make a robust file copying system:

http://www.phpclasses.org/httpclient


-- 

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/

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

Hello,

on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
> I see your point. Here in my case the server I want to copy a file on
> has 192.168.1.1 for IP address and thus cannot be found from outside a
> LAN, so the security problem is not that much important. But I agree
> with you and see what you mean.

You may want to try sending files via form upload. Then on the
destination end the you could have a PHP script that would take care of
authentication and receiving and storing the uploaded files.

The destination server doesn't have PHP ....

Laurent

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

on 01/27/2006 11:07 AM Laurent Vanstaen said the following:
>> > I see your point. Here in my case the server I want to copy a file on
>> > has 192.168.1.1 for IP address and thus cannot be found from outside a
>> > LAN, so the security problem is not that much important. But I agree
>> > with you and see what you mean.
>>
>> You may want to try sending files via form upload. Then on the
>> destination end the you could have a PHP script that would take care of
>> authentication and receiving and storing the uploaded files.
> 
> The destination server doesn't have PHP ....

It that case you need to use a different kind of file server support.
For instance, if it has Samba (Windows like file shares), you can try
this other class:

http://www.phpclasses.org/smbwebclient

-- 

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/

--- End Message ---
--- Begin Message ---
Laurent,

Laurent Vanstaen wrote:
> 
>> Hello,
>>
>> on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
>> > I see your point. Here in my case the server I want to copy a file on
>> > has 192.168.1.1 for IP address and thus cannot be found from outside a
>> > LAN, so the security problem is not that much important. But I agree
>> > with you and see what you mean.
>>
>> You may want to try sending files via form upload. Then on the
>> destination end the you could have a PHP script that would take care of
>> authentication and receiving and storing the uploaded files.
> 
> The destination server doesn't have PHP ....

When you say "Livebox", are you in fact referring to the router given
out by your ISP?  If so, what makes you think it's writable in the first
place?

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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


Laurent Vanstaen wrote:
>
>> Hello,
>>
>> on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
>> > I see your point. Here in my case the server I want to copy a file on
>> > has 192.168.1.1 for IP address and thus cannot be found from outside a
>> > LAN, so the security problem is not that much important. But I agree
>> > with you and see what you mean.
>>
>> You may want to try sending files via form upload. Then on the
>> destination end the you could have a PHP script that would take care of
>> authentication and receiving and storing the uploaded files.
>
> The destination server doesn't have PHP ....

When you say "Livebox", are you in fact referring to the router given out by your ISP ?

Yes, that's it.

If so, what makes you think it's writable in the first place?

'Cause I work for this ISP ....

Laurent

--- End Message ---
--- Begin Message ---
Laurent,

Laurent Vanstaen wrote:
>> If so, what makes you think it's writable in the first place?
> 
> 'Cause I work for this ISP ....

So you don't have specs then I guess, since you're asking in a public
forum!  Have you considered using a HTTP PUT request (using cURL)?

php.net/curl

$curl = curl_init();
$file = "replacementfile.txt";

curl_setopt($curl, CURLOPT_URL, 'http://192.168.1.1/cgi-bin/newCrontab');
curl_setopt($curl, CURLOPT_PUT, true);
curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file));
curl_setopt($curl, CURLOPT_INFILE, fopen($file, 'r'));

curl_exec($curl);

Note: you might need to set the CURLOPT_USERPWD option too.

This is my best guess at a solution, but obviously I've not tested it.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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

>> If so, what makes you think it's writable in the first place?
>
> 'Cause I work for this ISP ....

So you don't have specs then I guess, since you're asking in a public forum !

Bingo :)
Shitty product bought on the shelf from a third party, no specs, no doc ...

Have you considered using a HTTP PUT request (using cURL)?

I'm trying it. Thank you.

Laurent

--- End Message ---
--- Begin Message ---
Chris Boget wrote:
Let me start by saying there is nothing wrong with the above and it's doing exactly what the OP needed. However, when I use variable variables, I prefer to use the following notation:
${$foo}
It makes the coder's intention clear and makes it so that it can't be mistaken for a possible typo when someone comes in after the fact to maintain the code.

And When I use this and when i use that. Oh i like this ^_^
Btw. my working buddys said on first view your example looked more wrong.


Try it and see. ;)

Try what? ^_^


And on top of that, i wont let anyone code in my PHP docs who doesn't know what $$var is or does!!


Agreed.  But there have been a few times when I accidently added in an
extra $ to the variable and, consequently, didn't get the results I expected.

Never happened to me ;)
I mostly look at the screen programming :)

PHP - Best coded with: Open eyes O_O

--
Smileys rule (cX.x)C --o(^_^o)

--- End Message ---
--- Begin Message ---
Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
file_exists() returne an open_basedir warning, but earlier PHP versions did 
not. Is this true?

""DRYALLS"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I have 2 different PHP installs, each are slightly different versions, and 
>each have different open_basedir restictions.
>
> I have a PHP script that fails on ONE of the installs but NOT the other.
>
> The line that fails is $foo = file_exists("/proc/loadavg");
>
> What I don't understand is why one script fails, yet the other does not 
> because NEITHER have /proc in the open_basedir path.
>
> What could be different about the PHP configs that makes one report a PHP 
> warning, yet the other does not? 

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

Perhaps you refer to this (fixed in 4.3.3):

http://bugs.php.net/bug.php?id=24313

David

DRYALLS wrote:
> Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
> file_exists() returne an open_basedir warning, but earlier PHP versions did 
> not. Is this true?
> 
> ""DRYALLS"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>> I have 2 different PHP installs, each are slightly different versions, and 
>> each have different open_basedir restictions.
>>
>> I have a PHP script that fails on ONE of the installs but NOT the other.
>>
>> The line that fails is $foo = file_exists("/proc/loadavg");
>>
>> What I don't understand is why one script fails, yet the other does not 
>> because NEITHER have /proc in the open_basedir path.
>>
>> What could be different about the PHP configs that makes one report a PHP 
>> warning, yet the other does not? 
> 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

--- End Message ---
--- Begin Message ---
Perhaps you saw it here:

http://php.net/file_exists

Search the page for "ceo at l-i-e dot com" or "open_basedir".

David

DRYALLS wrote:
> Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
> file_exists() returne an open_basedir warning, but earlier PHP versions did 
> not. Is this true?
> 
> ""DRYALLS"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>> I have 2 different PHP installs, each are slightly different versions, and 
>> each have different open_basedir restictions.
>>
>> I have a PHP script that fails on ONE of the installs but NOT the other.
>>
>> The line that fails is $foo = file_exists("/proc/loadavg");
>>
>> What I don't understand is why one script fails, yet the other does not 
>> because NEITHER have /proc in the open_basedir path.
>>
>> What could be different about the PHP configs that makes one report a PHP 
>> warning, yet the other does not? 
> 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

--- End Message ---
--- Begin Message --- My company is looking for a PHP developer to work out of their London office. If you live in/around the city and are interested, please respond to me (personally, not the list :p) with your resume/CV.

thnx,
Chris
--- End Message ---
--- Begin Message ---
hi,
   for eg 
                          
while(list(t1,t2,...)=mysql_fetch_row($result)):
                            endwhile;
 while i use $t1 ouside while loop ,its corresponding
value is not  displaying,how can i display the value
of $t1.

                                              A.suresh


                
__________________________________________________________ 
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com

--- End Message ---

Reply via email to