Hello all,
I am trying to pull in some content from an external website and managed this using; -
<?php
$url = file_get_contents($this->wrapper->url);
echo $url;
?>
However, my first problem started when it transpired that the site I am pulling from has a DIV called 'footer' and my site has a DIV of the same name.
I managed to get around this using the str_replace: -
<?php
$url = file_get_contents($this->wrapper->url);
$output = str_replace ( 'footer', 'credits', $url );
echo $output;
?>
So far , so good. However, the next hurdle is that the data that I am pulling in contains links to more information. If I click on the link then I am taken away from my site and the results are shown directly from the originating site. I have used the str_replace function as I needed to append the correct http path to the links: -
<?php
$url = file_get_contents($this->wrapper->url);
$searchReplaceArray = array(
'footer' => 'credits',
'PlayerHistory.php?CWID=15025' => 'http://masterscoreboard.co.uk/results/PlayerHistory.php?CWID=15025' );
$output = str_replace(
array_keys($searchReplaceArray),
array_values($searchReplaceArray),
$url );
echo $output;
?>
So my question is this - is it possible to use something similar to a nested get_file_contents on the links so that I am not redirected away from my site?
If it is of any use my site is being created in Joomla 1.6 and I have amended the wrapper_com so that it doesn't use iFrames.
Sorry if my terminology is not good and hopefully you will see what I am trying to achieve.
Any 'eureka' moments will be greatly appreciated.
Thanks in advance...