Skip to content Skip to sidebar Skip to footer

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 conveni

Solution 1:

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.

Solution 2:

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.

Solution 3:

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

Solution 4:

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.

Solution 5:

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

<scriptsrc='freelancerssite.com/codeIneed.php'>

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

Post a Comment for "How To Grab Code From Another Website (that I Control)?"