Subject: Re: Request for help for beginner, thanks!

Re: Request for help for beginner, thanks!

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 18 Jan 2021 08:44:55 -0800

On Sun, Jan 17, 2021 at 01:40:04PM -0500, David Spector wrote:
> Thanks for the suggestion. I appreciate the time you have spent on this.
>
> As a beginner in this area, this code is not understandable. That is why I
> asked for a working example (did I remember to say the example had to be
> tested and work? I tested my code and it works.).

If you're asking for a working example of a solution to your problem that is
tested and working, then your best bet is to hire someone to create one for
you. Open Source software includes documentation and examples so that
programmers can create such examples on their own. It's not possible to scale
free support to everybody who might use the free software otherwise.

> I see lots of code here, but nothing that includes the pathname of a private
> key, and nothing that actually works. sFTP requires a private key to be
> meaningful, to the best of my knowledge.

The documentation describes how to do this. In this case, you're probably
looking for CURLOPT_SSH_PRIVATE_KEYFILE in the libcurl C binding. But, further
questions on curl should be sent to either the libcurl mailing list or the
appropriate PHP cURL support forum, as appropriate.

> I mean, the whole point is to secure the file transfer between my
> development computer and my production server. With sFTP one does that using
> a public key remotely and a private key locally. I already have the keys
> installed and they work with both coreFTP and PuTTY.
>
> Now all I need is for someone who has done this task successfully to share
> with me a minimal working piece of PHP code. I've already spent weeks on
> this and I can't spare more time for research or trial and error, which is
> why I am posting here.
>
> I'm looking for someone who has done this task (hopefully in PHP ssh2) and
> is willing to share some simple code to get it done.
>
> Yes, I can believe it can be done using cURL, ssh2, etc., but I just need to
> get some working code. It seems that nobody has any complete and working
> code posted on the Web anywhere, including in the PHP Manual itself.

It's a pretty big demand to ask people to write your code for free. There are
many examples of use of sftp in libssh2 and libcurl available to you with a
search and lots of documentation to help you customize them for your exact
purposes. Try getting one of the example programs working in a simplified case
then only then alter it. If the documentation is inadequate or wrong, then
we'd be interested in hearing how to improve it.

Dan
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2021-01-18