Hotlinking php code??

Discussion in 'PHP' started by kuteetap, Apr 22, 2010.

  1. #1
    Hi I need to get this done if its possible.

    Is it possible to have this code <?php include(www.websites.com/code.php); ?>

    My purpose is i wanted to put a code on many websites and when i update that code all of the websites i insert the code will be updated as well.

    Please let me know how can i do this...

    thanks in advance...
     
    kuteetap, Apr 22, 2010 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you want to do that you will need to output the code without it going through the php parser on the main site
    See readfile()
     
    JAY6390, Apr 22, 2010 IP
  3. System 6 Hosting

    System 6 Hosting Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Have all your remote sites include the file as you've shown. Then use ftp functions in code to upload the included file whenever you change it. That's assuming remote computers. If it's all sites on one server then just symlink.
     
    System 6 Hosting, Apr 23, 2010 IP
  4. kuteetap

    kuteetap Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi can you give a sample code for that???
     
    kuteetap, Apr 24, 2010 IP
  5. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #5
    You could do:

    Create a file on remoteapiserver.com named code.txt and place within it:

    /* php code within no php tags. */
    echo "hey";
    PHP:
    And then on other websites call it like:

    <?php
    //execute the remotely located php code...
    eval(file_get_contents('http://remoteapiserver.com/code.txt'));
    ?>
    PHP:
     
    danx10, Apr 24, 2010 IP