php在这个服务器的PHP文件去执行远程的PHP

2025-02-23 20:37:50
推荐回答(3个)
回答1:

如果你的服务器在php.ini文件中激活了allow_url_fopen 选项,你可以使用以下的语句:

$page_url="http://www.baidu.com/1.php";
$contents = file_get_contents($page_url);

否则,你可以参考下面的例子.
获取远程文件的标题
$file = fopen ("http://www.example.com/", "r");
if (!$file) {
echo "

Unable to open remote file.\n";
exit;
}
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("(.*)", $line, $out)) {
$title = $out[1];
break;
}
}
fclose($file);
?>

回答2:

很简单啊..只要用隐藏框架就行啦

回答3:

如果需要取回特定值,建议使用Ajax