I have an website. Let's call it http://www.domain.com
. Now, on this domain.com I want to display the file contents of http://www.adserversite.com/ads.php
. How can I do that with cURL or another method? I don't want to use iframe
.
Thanks
You can use file_get_contents
as Petr says, but you need to activate allow_url_fopen
in your php.ini
and perhaps your hosting do not allow you to change this.
If you prefer to use CURL instead of file_get_contents
, try this code:
<?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);
echo file_get_contents('http://www.adserversite.com/ads.php');
Who needs curl for this simple task?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With