Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sending a file to SFTP using cURL

    hey guys, having a nightmare with this one, I need to send a file using cURL to an SFTP server (NOT FTPS) problem is I keep getting the error

    Code:
    Protocol SFTP not supported or disabled in libcurl
    How on earth do I enable SFTP support in libcurl? google is no good this time due to it blocking the keyword sftp anyone have any ideas?
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    curl doesn't allow sftp connections.
    Methinks ssh library is what you want to use.
    Oh yeah, and you should also be able to use the ftp library. Duh on my part there.

    Edit:
    Actually, I'll retract that. Looks like the FTP extension will let you use ftps but not sftp. So its back to ssh then.
    Last edited by Fou-Lu; 03-04-2009 at 05:46 PM.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    curl doesn't allow sftp connections.
    Methinks ssh library is what you want to use.
    Oh yeah, and you should also be able to use the ftp library. Duh on my part there.

    Edit:
    Actually, I'll retract that. Looks like the FTP extension will let you use ftps but not sftp. So its back to ssh then.
    I did have the idea of using scp or sftp from the shell and use php to exec it but sadly doesn't look like it can be done with a one liner.
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Quote Originally Posted by neomaximus2k View Post
    I did have the idea of using scp or sftp from the shell and use php to exec it but sadly doesn't look like it can be done with a one liner.
    Yeah, its no DOM, but it does require a lot of separate calls compared to the ftp and curl uses. Sadly I think that this is the only way to use sftp from PHP using the bundled extensions.
    If you google you may be able to come up with some custom ones. I'm pretty sure I've used proc_open before to handle this, but then that leaves you with a greater reliance on the OS to have the necessary programs to run.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well in this case its only going to be running on one server which I have full control over, just dont like the look of recompiling libcurl as other scripts use it.

    Also I googled for hours with no luck as sftp doesn't get searched by google
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I haven't done any testing or anything, but apparently curl will work with sftp on 7.16+. I found this thread here, maybe it could be of some help (the ending problem was pointing to different versions of the curl):
    http://www.phpbuilder.com/board/show...php?t=10358369
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ooohhh nice! I can know I have 7.19 installed on server as shown with curl-config --version so i'll give it a go and will let you all know!
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #8
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sadly I tried the curl command on the given page, exactly the same error
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •