我有2个php文件:
serwer1.pl/file1.php
:
$code = ($_GET['code']);
$myfile = fopen("main.txt", "w") or die("Unable to open file!");
fwrite($myfile, $code);
fclose($myfile);
echo $code;
serwer2.pl/file2.php
:
$code = "fQMAANtYAAJDAP8xAHwAQgBBAOdOADD7NAA1ADMK3jkqMvcCMR5uElMAVP1CUgBPvxMgAFcA/kUASgBIAEX7K1cu90sASVL7dQBsAC6CtUJN705KV700Ljj7Ci0AMsfae5tPQrUCR/cvIFa+Mwc29yZNR95DCkT3BlOGuEIOLlZaAHzdAzLtq2pUey58gt5EQjH3JjQqgziD3EYKFYo34Aoz7ttfvTEeLe4PCwZDvS0DuA5QAEUtx6AKT/eLU9uxGyxLINADOXurNevvMBo0eLYzK+e7MyoaAoq/VX5JAEFiF8NXA3x8i3wQCwRhzHtvtBOHrzMTMX4WOAAwGnfYD28yOwQjtxI3ADVgS+8yN2sCLD93MQKxMBv2UAAge+85zi0Hp7wtHxkvpotTDlJNHhpDPo7TLuogjjvRBkL7o1lTW5cLIwMye9+frkEC12Y4FkbrojH3wceDg7swADgPbQMsO7QLsCezA04hbDOGF1mPDrcJJJJJKv9QO";
echo ($code);
如何将CODE变量从server2(文件2)发送到server1(文件1)?
答案 0 :(得分:2)
使用卷曲,
将此代码添加到您的服务器2 文件:http://php.net/manual/fr/function.curl-exec.php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://yourdnsserver1/?code=yourcode");
curl_exec($ch);
curl_close($ch);