l3rodey Posted November 7, 2013 Share Posted November 7, 2013 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... Quote Link to comment https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/ Share on other sites More sharing options...
.josh Posted November 7, 2013 Share Posted November 7, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/#findComment-1457300 Share on other sites More sharing options...
l3rodey Posted November 7, 2013 Author Share Posted November 7, 2013 Hi Josh, What I am doing and how I am doing it is not black hat it sounds black hat but it isn't (should be) or not yet anyways. I might need to look into the file_get_content form, and do a a str_replace. argh more work on this tool then expected 0.0 Quote Link to comment https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/#findComment-1457303 Share on other sites More sharing options...
.josh Posted November 7, 2013 Share Posted November 7, 2013 Okay well, if you don't think so, then whatever floats your boat. I happen to work in the analytics/ppc/seo industry, so just giving you my PoV. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/#findComment-1457318 Share on other sites More sharing options...
QuickOldCar Posted November 7, 2013 Share Posted November 7, 2013 I agree with josh, and on top of that if fetch the page and host it....is almost like content theft, not to mention will have to fix all their relative urls for links to work the same. Quote Link to comment https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/#findComment-1457322 Share on other sites More sharing options...
.josh Posted November 7, 2013 Share Posted November 7, 2013 I agree with josh, and on top of that if fetch the page and host it....is almost like content theft, not to mention will have to fix all their relative urls for links to work the same. fixed. Quote Link to comment https://forums.phpfreaks.com/topic/283673-str_replace-in-an-iframe/#findComment-1457323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.