[英]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.