How to grab code from another website (that I control)?

I want to enter a line of php into my site and have it echo out code that is to be entered on my site. Essentially I am controlling a part of a clients’ site and it is more convenient for all involved if I can change it without requiring them to upload it. This must be a long solved issue, but I cannot find a solution. Also, I am not sure if this is possible if my code is server side. Thoughts, help, suggestions?

  • connection string to a SQL Server cluster
  • SQL - Clone a record and its descendants
  • Update a table from two comma separated parameter as input
  • How to search for a specific string in all columns within all tables of a SQL Server database?
  • TSQL Execute result different in PHP and SSManagement Studio
  • Which is faster, EXISTS before or after the INSERT?
  • How to change clients' site dynamically?
  • 5 Solutions collect form web for “How to grab code from another website (that I control)?”

    You should figure out a different approach to fixing this problem. From the top of my head, you could probably write a utility that allows, with a username and password, you to replace specific files.

    Using code from another site, even if you control it, is incredibly dangerous. All a would-be attacker has to do is spoof the address through one of many means, and they could literally do anything on the server that the script has privileges to do. For completeness, you are looking for “eval”, but you want to use a different approach.

    My thoughts and suggestions… don’t do it! Here are a few reasons why:

    1. Security: This is the biggest
      reason.
    2. Latency: Your clients website will
      run slower because it has to pull
      code across the net in order to
      work.
    3. Downtime: What happens when your
      server goes down? It takes down your
      clients server possibly opening it
      up to attacks.

    Everything about the idea is bad. There is a line between doing something because you can and doing something because you should. This is definitively as SHOULDN’T.

    Y’know, PHP has FTP support built-in. Maybe you could write a remote deployment app.

    This is what ssh was created for:

    ssh user@remotehost 'execute remote command here'
    

    I wouldn’t do anything like this in PHP no matter the implementation because it is a huge security vulnerability.

    When you say you have PHP echoing out code onto your side, I assume it’s php echoing out javascript. This means that you can also print out the js to a different file and link to it.

    for example, the php on your server could look like this:

    echo "function doCoolStuff(){alert("I am awesome!");}\ndoCoolStuff();";
    

    on the client’s page, you say

    <script src='freelancerssite.com/codeIneed.php'>
    

    This way, the client always gets the code you have on your server.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.