【发布时间】:2014-09-25 06:57:48
【问题描述】:
我有 ssh,我想用于 cURL。
这是我的代码
<?php
$server = '123.456.789.012';
$port = 22;
$user = 'root';
$pass = '123456';
$connection = ssh2_connect($ip, $port, $methods, $callbacks);
if (!$connection) die('Connection failed');
$auth = ssh2_auth_password ($connection, $user, $pass);
$tunnel = ssh2_tunnel($connection, '127.0.0.1', 1080);
if(!$tunnel) die('error');
$url = 'http://dynupdate.no-ip.com/ip.php';
$proxy = '127.0.0.1:1080';
//$proxyauth = 'user:password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo "ok ".$curl_scraped_page;
?>
我使用的是 CentOS 操作系统
谁能帮帮我
【问题讨论】:
-
这真的不是代码问题。我建议将其移至:unix.stackexchange.com
-
我不能使用 [code] 标签。有错误