Doc #54665 [NEW]: CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented
| From: | bhaskarna at yahoo dot com | Date: | Thu, 05 May 2011 07:20:54 +0000 |
| Subject: | Doc #54665 [NEW]: CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6344@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented
Description:
------------
CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not
documented. They are useful when we require to scp or sftp a file thru curl
api.
I could achieve successful sftp using above said curl_setopts
Test script:
---------------
<?php
$certPath="/home/y/conf/yapache/ssh-keys/akamai.id_rsa.pub";
$keyPath="/home/y/conf/yapache/ssh-keys/akamai.id_rsa";
error_reporting(E_ALL);
ini_set('display_errors', 1);
$ch = curl_init();
$localfile = 'scp-small-file.txt';
$fp = fopen($localfile, 'r');
curl_setopt($ch, CURLOPT_URL,
'sftp://@72.246.194.54/21996/'.$localfile);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch,CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_SFTP);
curl_setopt($ch, CURLOPT_SSH_PUBLIC_KEYFILE, $certPath);
curl_setopt($ch, CURLOPT_SSH_PRIVATE_KEYFILE, $keyPath);
curl_setopt($ch, CURLOPT_USERPWD,'sshacs');
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_exec ($ch);
$error_no = curl_errno($ch);
curl_close ($ch);
if ($error_no == 0) {
$error = 'File uploaded succesfully.';
} else {
$error = 'File upload error.';
}
echo $error.' '.$error_no;
?>
* About to connect() to 72.246.194.54 port 22 (#0)
* Trying 72.246.194.54... * connected
* Connected to 72.246.194.54 (72.246.194.54) port 22 (#0)
* SSH authentication methods available: publickey
* Using ssh public key file
/home/y/conf/yapache/ssh-keys/akamai.id_rsa.pub
* Using ssh private key file /home/y/conf/yapache/ssh-keys/akamai.id_rsa
* Initialized SSH public key authentication
* Authentication complete
* Connection #0 to host 72.246.194.54 left intact
* Closing connection #0
File uploaded succesfully. 0
--
Edit bug report at http://bugs.php.net/bug.php?id=54665&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54665&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54665&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54665&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54665&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54665&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54665&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54665&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54665&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54665&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54665&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54665&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54665&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54665&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54665&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54665&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54665&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54665&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54665&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54665&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54665&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54665&r=mysqlcfg