PHP include on someone elses site

Discussion in 'PHP' started by Jboo, May 2, 2007.

  1. #1
    Is it possible to have a PHP include on someone elses site? For example I have been asked to create a design for someone's site, but instead of putting a link to my site in the footer I would like to add a PHP include so that I could change the link url and text anytime I want with a simple file that's uploaded to my server.

    Is this possible?
    Could there be any problems?
    Is there a better way to achieve the same affect?

    Thanks for any feedback.
     
    Jboo, May 2, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    you could use a tag like <?=file_get_contents("http://domain.com/path/to/file.php"); ?> in thier file, I imagine they would much prefer a javascript though, it's not ideal
     
    krakjoe, May 2, 2007 IP
  3. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you use server-side scripting (eg PHP), every time he gets a pageview his server has to fetch your page off your server and send it out to the browser. Despite most servers now capable of running PHP, you never see any templates on oswd (or similar) that force a dynamic copyright / "design by" link in this way - it's very obtrusive taking away someone's control over their own pages but more than anything not worth the hassle.

    If you really really have to, an iframe would be your best option. At least your forcing the extra work onto the client rather than someone else's server. And it should be a more widely compatible than javascript.
     
    rodney88, May 2, 2007 IP
  4. Jboo

    Jboo Active Member

    Messages:
    229
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Thanks krakjoe and rodney. I thought it might not be the best idea but thought i'd check first. I'll have a think about the iframe idea, but it may be best to just add my link regularly and leave it at that.

    Thanks for your help.
     
    Jboo, May 3, 2007 IP
  5. Gadgee

    Gadgee Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I am doing just this but have a slight problem.

    Can I say first off that my total PHP experience to date is the insertion of

    <?php include("http://www.external_host.net/scripts/show.mv");?>

    into a web page!!

    That works fine with the output from show.mv appearing in the web page.

    What I now need to do is to find a way of generating

    <?php include("http://www.external_host.net/scripts/show.mv?+string");?>

    where 'string' is the value of 'action' in the URL - i.e.

    http://www.calling_host.net/calling_page.php?action=search

    so what I really want is

    <?php include("http://www.external_host.net/scripts/show.mv?+search");?>

    How do assign a variable with the value of whatever 'action' is set to and then implant/concatenate that value into the INCLUDE statement?

    Hope that makes sense (and I promise to learn PHP soon!)
     
    Gadgee, May 3, 2007 IP
  6. KalvinB

    KalvinB Peon

    Messages:
    2,787
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <?php include("http://www.external_host.net/scripts/show.mv?$search");?>

    Where $seach is your parameter string
     
    KalvinB, May 3, 2007 IP
  7. Spikeon

    Spikeon Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    wow thanks, i needed this info as well.
     
    Spikeon, May 3, 2007 IP
  8. fireshark

    fireshark Peon

    Messages:
    190
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    or include("http://dgdfgsghfh.com/show_mv?" . $search);
     
    fireshark, May 5, 2007 IP