I Need A Little Bit Of Coding Help - Tell Me If This Is Possible

10 replies
Ok so I have no idea how I'm gonna do it but it is possible I think.

What Im doing now is redirecting users from different pages so what I want to do is find out what website the user is coming from and then iframe the page that they came from 100%. So they get redirected from Hasbro Games and then come to my site. The code will see where they came from and put that link in the iframe so it will iframe Hasbro Games

Is this possible? And if you could give me some ideas on a code that could work that'd be really helpful!
#bit #coding
  • Profile picture of the author Social Experts
    Will pay $5 for a solution
    Signature

    Chill.

    {{ DiscussionBoard.errors[2865252].message }}
  • Profile picture of the author kkoechel
    your question isn't clear. What do you mean by iframe?

    Do you want like a landing site that mimics a legit biz? That is probably unethical at best, and probably a crime.
    {{ DiscussionBoard.errors[2865265].message }}
  • Profile picture of the author Social Experts
    Yes I want it to mimic the page they just came from if that makes more sense?
    Signature

    Chill.

    {{ DiscussionBoard.errors[2865406].message }}
  • Profile picture of the author caesargus
    Well I'm not sure what your purpose would be for attempting something like this, but most browsers will pass along a variable called "http_referer" (Available in the browser object).

    You can reference this variable and have the page create the iframe (Or you can perform a curl/screen scrape). You probably would not get the "same" site that was just left, since you'll be using a completely different browser (the server not the client's computer) to bring up the page (well that depends on the particular solution you deploy).

    Plus you'll probably interrupt the user experience doing something like this. So the real question is what do you want to do with the data about the previous site? Are you trying to do a search and replace on the content and insert your own content in place of items, or are you just trying to show the user something cool and not doing anything with the data ... - again different solutions yield different results, so it's better to understand what you're end goal is before any actual work is done.
    {{ DiscussionBoard.errors[2865550].message }}
  • Profile picture of the author kkoechel
    all ethics aside, it's very doable in perl and php, and probably any language.

    here is the php

    <?php
    $raw = readfile("httpCOLON//remotesite.com/somepage.php");
    print $raw[0];
    ?>

    EDIT; I am being sort of funny. That code will literally dump the html contents. You would need to change the links and stuff and do some more stuff, obviously to make the landing page useful.
    {{ DiscussionBoard.errors[2866456].message }}
  • Profile picture of the author Social Experts
    What will I need to edit? I don't want it to dump my html
    Signature

    Chill.

    {{ DiscussionBoard.errors[2866675].message }}
  • Profile picture of the author kkoechel
    it depends on the html. If you run that on your web server you will see a page similar to the page you "get" in addition to (probably) many broken links.

    The key is to view the source and then change the links to ones you control.

    The scope of doing that is beyond this forum, there are books on php everywhere and really good online tutorials. I would link you to some, but linking doesn't seem to work until I rack up 15 of these post things.
    {{ DiscussionBoard.errors[2866878].message }}
  • Profile picture of the author Social Experts
    Well all I want to do is have a website like this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Full Page IFrame</title>
    <style type="text/css">
    html {overflow: auto;}
    html, body, div, iframe {margin: 0px; padding: 0px; height: 100%; border: none;}
    iframe {display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden;}
    </style>
    </head>
    <body>
    <iframe id="tree" name="tree" src="REFERRAL PAGE" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"></iframe>
    </body>
    </html>
    So the page they just came from is the referral page
    Signature

    Chill.

    {{ DiscussionBoard.errors[2866991].message }}
    • Profile picture of the author kkoechel
      $domain = $_SERVER['HTTP_REFERER']; #typo is known, apparently

      use that variable for the referrer domain in a <?php ?> block with the html printed with a HERE statement or something.
      {{ DiscussionBoard.errors[2867300].message }}
  • Profile picture of the author ASUService
    Sorry that I'm not adding to a solution for you but I wanted to post something you may not be aware of.

    Should any secure (SSL/https) urls be fed via an iframe you'll break the secure connection. Please keep this in mind as you could inadvertently cause issues for your site visitors.

    IMHO you really shouldn't do this but, hey, what do I know.
    Signature

    Best Regards,
    Mike Allton
    ASU Service, Inc.
    The LAST SMS Platform You'll Ever Need! Easy Money!

    {{ DiscussionBoard.errors[2867013].message }}

Trending Topics