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

php在这个服务器的PHP文件去执行远程的PHP
如果这个文件1.php执行的时候要在另一个服务器执行www.baidu.com/1.php呢?谁帮我QQ185259693在线等

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

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

否则,你可以参考下面的例子.
获取远程文件的标题
<?php
$file = fopen ("http://www.example.com/", "r");
if (!$file) {
echo "<p>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 ("<title>(.*)</title>", $line, $out)) {
$title = $out[1];
break;
}
}
fclose($file);
?>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2006-10-10
很简单啊..只要用隐藏框架就行啦

<iframe height="0" width="0" frameborder="0" scrolling="no" src=""></iframe>
第2个回答  2006-10-12
如果需要取回特定值,建议使用Ajax

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网