I’m trying to load content from other website to my wordpress website with cURL. The problem that I have is that links in the iframe are displayed like that are being loaded from my website.
Ie. in the original websites from where I pull the content there is link originalwebsite.com/product123 but on my website in the iframe i see mywebsite.com/product123 how to remove my website from all a hrefs and use original links?
These are my files:
redirect.php has this code:
<?php
if (isset($_GET['url'])) {
$url = $_GET['url'];
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
}
my page template has this code:
<?php
/**
* Template Name: i-frame
*/
?>
<?php get_header(); ?>
<div id="primary" class="content-area">
<div class="primary-inner_">
<div id="content" class="site-content content-list" role="main">
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="page-header">
<h1 class="page-title"><?php the_title(); ?></h1>
</header>
<div class="page-content">
<iframe id="elframe" src="<?php echo get_stylesheet_directory_uri(); ?>/redirect.php?url=http://www.partners..com/en/106597" frameborder="0" style="width:1020px; min-height:7935px; margin: 0 auto;display:block"></iframe>
<?php the_content(); ?>
</div>
</article>
<?php
endwhile;
else :
get_template_part( 'no-results', 'index' );
endif;
?>
</div>
</div>
</div>
<?php get_footer(); ?>