我有一个网站.我们称之为http://www.domain.com.现在,在这个domain.com上我想显示文件内容http://www.adserversite.com/ads.php.我怎样才能用cURL或其他方法做到这一点?我不想用iframe.
谢谢
m4t*_*1t0 47
您可以file_get_contents像Petr说的那样使用,但是您需要allow_url_fopen在您php.ini的主机中激活,也许您的主机不允许您更改此设置.
如果您更喜欢使用CURL file_get_contents,请尝试以下代码:
<?php
$url = 'http://www.adserversite.com/ads.php';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
Run Code Online (Sandbox Code Playgroud)
Pet*_*etr 12
echo file_get_contents('http://www.adserversite.com/ads.php');
Run Code Online (Sandbox Code Playgroud)
谁需要卷曲这个简单的任务?