E
E
Evgeny572020-06-05 16:29:18
PHP
Evgeny57, 2020-06-05 16:29:18

How to set up parsing via ssh php?

$connectt = ssh2_connect('190.195.218.196', 22);
print_r($connectt);
$check = ssh2_fingerprint($connectt);

if($check) {
    $connect = (ssh2_auth_password($connectt,'git', 'git'));
} 
$tunnel = ssh2_tunnel($connectt, '127.0.0.1', 22);
print_r($tunnel);

print_r($connectt);
print_r($_SERVER);

$url = "https://2ip.ru";
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,  CURLOPT_SSL_VERIFYPEER , false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:22');
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
$response = curl_exec($ch);
$responseInfo = curl_getinfo($ch);
$err = curl_error($ch);
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
curl_close($ch);
print_r($response);

Gives an error with the proxy type Socks5,, socks4
Which way to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUser0, 2020-06-05
@AUser0

In the direction of running a real, real SOCKS4 or SOCKS5 proxy on a free (for example, 8080) port instead of the 22nd one, which is used by default for SSH.
If you don't have SOCKS5 PROXY on the local port 22, then why knock on it?

A
Alexey Sundukov, 2020-06-05
@alekciy

In the direction of buying a normal proxy. Or use public free ones.
PS 2ip.ru really doesn't like it when they are parsed. If you want to get something from there - use webdriver + proxy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question