I want to call the data of another website on one website, so that both websites can call the same data, just like
is called locally.
For example: my website a and website b
If I enter: http://www.a.com/x.php/123/456.rar
actually call The one is: http://www.b.com/123/456.rar (the real file storage address)
When downloading, it still shows that it is downloaded from www.a.com.
My x.php is like this:
<?php header("content-Type: text/html; charset=Utf-8"); $SERVER=$_SERVER["REQUEST_URI"]; preg_match("/php\/([\s\S]+)\.rar/",$SERVER,$url); $urlname=$url[1]; $songurl='http://www.b.com/'.$urlname.'/'; header("location:$songurl"); ?>
It is through this code that 123 in the first URL is passed to the second URL.
But the code above did not pass successfully:
I entered http://www.a.com/x.php/123/456.rar, and the second URL displayed was:
http://www.b.com. "123" is not displayed in the URL. Please tell me what modifications I need to make so that the second URL can get the passed parameters "123" and "456".
1. First confirm whether the content in
$_SERVER["REQUEST_URI"] is x.php/ 123/456.rar
2. The regular expression is actually changed to
preg_match("/php/([sS] .rar)/",$SERVER,$url);
$urlname=$url[1 ];
$songurl='http://www.b.com/'.$urlname; // In this way, it can be pieced together into a http://www.b.com/123/456.rar suffix ending with rar Links