English 中文(简体)
php - cks
原标题:php - socks proxy

过去15天,我打破我的头脑,解决这个问题。 我有一套PHP应用程序,与遥远的神话服务器连接,但应用可以直接进入遥远的神话服务器,必须通过一个cks子代理连接。 请允许我帮助我解决这一问题。

提前感谢。

问题回答

我期待着看到是否有任何其他人这样做,但我不认为这样做。 我为PHP与SOCKS4a进行了接口。 这里就是这样。

function fsocks4asockopen($proxyHostname, $proxyPort, $targetHostname, $targetPort)
{
    $sock = fsockopen($proxyHostname, $proxyPort);
    if($sock === false)
        return false;
    fwrite($sock, pack("CCnCCCCC", 0x04, 0x01, $targetPort, 0x00, 0x00, 0x00, 0x01, 0x00).$targetHostname.pack("C", 0x00));
    $response = fread($sock, 16);
    $values = unpack("xnull/Cret/nport/Nip", $response);
    if($values["ret"] == 0x5a) return $sock;
    else
    {
        fclose(sock);
        return false;
    }
}

它并非完全是任何类型的最后产品,而是将允许你与PHP的cks子4a代理商建立联系,并用火 the取回你同样的袖珍。

我认为,你需要通过你的SOCKS代理建立港口。 随行,你开通了当地港口(如3306),通过SOCKS代理将连接到偏远的东道国和港口(数据库:3306)。 你在这种背景下这样做,使PHP与当地东道方连接起来:3306(然后转交/转交数据库:3306)





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签