views:

45

answers:

4

Hi,

I'm working on making a website/web application that displays images every 5 or so minutes, kinda like a webcam. The images are uploaded to an SFTP server. How can I access those from the web? Does anyone have any recommendations for what to use as well? Right now I'm looking at PHP but have checked out javascript and ruby as well. Only the application needs to ssh to a predetermined place, not the users.

I was suggested by a friend to use rsync and setup passwordless ssh. Anyone ever do this? or is this a bad idea?

A: 

You need to write a server-side script that connects to the SFTP server and forwards the image to the client.

SLaks
A: 

cURL has SFTP support.

vartec
Are you sure? Curl only supports FTPS as far as I know.
ZZ Coder
It does support sftp (http://curl.haxx.se/docs/manual.html)
hometoast
My question was misleading. Even though CURL library supports SFTP but CURL in PHP doesn't.
ZZ Coder
"Valid protocol options are: CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_FTP, CURLPROTO_FTPS, CURLPROTO_SCP, **CURLPROTO_SFTP**, CURLPROTO_TELNET, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_TFTP, CURLPROTO_ALL"
vartec
@ZZ Coder, cURL in PHP **does** support SFTP.
vartec
@vartec: Have you tried? I tested on PHP 5.2.11 and it doesn't work. PHP defines all the constants defined in libcurl but it has no wrapper for SFTP.
ZZ Coder
A: 

PHP supports SFTP. You need to install ssh2 extension,

http://www.php.net/manual/en/book.ssh2.php

ZZ Coder
I tried to get ssh2, but the support for windows seemed pretty poor
msandbot
No experience on Windows. I use it on Linux and it works fine.
ZZ Coder
yeah i've used it too, wish they had better multiplatform support
msandbot
+1  A: 

If the application is the only thing that needs to SSH then you can rule out javascript immediately. It's predominately a client-side language in these environments.

You may like at Net::SSH ruby library, or I'm sure there's a php equivalent. I have used Net:SSH and it's fairly straight forward.