Jump to content

str_replace() in an iframe


l3rodey

Recommended Posts

Hi All,

 

I am building a tool which requires a website in an iframe (external) but with wording changes... I want the page to be indexed via Google but not as a duplicate page, So I was thinking of using str_replace(), I was thinking Synonyms for example "str_replace("party", "celebrate")".

 

This way I would have massive library of synonyms and they just rotate randomly. My problem is str_replace isn't working for the content in the iframe.

 

Does anyone know how I can do this? The page is external I am using iframes although if there is a better way I can do that. But I need to change wording within an external page but display on mine, I might be able to use javascript I don't know but I don't think javascript is ran for google...

Link to comment
https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/
Share on other sites

First off you should know that swapping out content like this is a form of content stuffing, is considered blackhat seo tactics, is against Google's ToS and you will be blacklisted for it.

 

If this somehow doesn't deter you from doing it, then here's your next problem: You can't do this with an iframe hosted on another site. This is considered cross site scripting (XSS) (read up on same domain origin policy). The only way to do what you are wanting to do is to use something like file_get_contents or the cURL library and retrieve the contents of the page, use str_replace to swap out the content, and then output it on your own page, not hosted externally in iframe.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.