[英]How to get a URL from a remote txt/php file and load that URL?
如何从另一个站点上的text/php
文件获取URL
,然后打开该URL链接?
如果没有,则默认为default.php
我可以访问两个网站,
如果我正确理解,您希望站点A在站点B上请求URL。站点B随后将以URL进行响应,并且您要加载该URL。 您可以使用以下内容
<?
$url = 'http://www.siteb.com/givemeaurl.php';
$content = implode('', file($url));//
//$content now contains the response from site B. If its only the URL you can use it directly, else you need to parse the results
if (strlen($content)>0) {
//we have a value
$newurl = $content;
} else {
//no value
$newurl = 'default.php';
}
//no open the new site
header('Location: ' . $newurl);
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.