Of course.
Perhaps if you choose a template for variables.
If you notice that the pattern is a number, you can try something like this:
You do not want to show anything that will not be appropriate in the code or output, and you do not want to enter the filtering "on the fly", because this will only add delay. In get.php on the target machine:
if(!empty($_GET['a']) and is_numeric($_GET['a'])){ $id = $_GET['a']; $sql = "select contents from database where id='$id'"; $results = mysqli_query($sql); $row_cnt = mysqli_num_rows($result); if ($row_cnt == 1){ while ($row = mysqli_fetch_array($results)){ echo $row['contents']; } } elseif (empty($row_cnt) { echo "No results"; } else { echo "Too many records."; } } else { die; }
In a mining machine (machine 2):
$contents = ''; for($x=0;$x<150;$x++){ $contents.=file_get_contents('http://example.com/get.php?a='.$number); } echo $contents;
Remember when you open the URL over the Internet that you need:
- allow_url_fopen if necessary
- add a delay to not suppress the resources of the target server.
- make sure you are not violating someone's robots.txt file
- pass the correct headers, including user_agent, so that your server is not denied.
- increase the runtime limits if you use the script as a webpage under Apache.
cURL is much more suitable for this and contains many additional features.
Update - but this is probably not a good idea.
The above example will be for one or two pages, and not for viewing content on a website, like displaying content again. I misunderstood and thought that you were developing the site (one-time).
LAN On a local area network, a LAN showing content from one server to another should be fairly fast, and websites should be fast enough (by modern standards), even though you are mining content.
You want to add the domain of the target site and ip to the hosts file so that the system does not search for DNS (if caching is disabled) every time the function is called.
The same unit. If they were on the same computer, you can reboot the system if some pauses are not in place.
WAN If you are on two separate networks in two server farms separated by some distance, the number of transitions will greatly affect the performance of the script. This is not a good idea in terms of starting a real production server for any period of time. Most users will not wait a couple of seconds to load the page.
In addition, you will want to filter the ip mining server from the statistics for the started server, since it will look as if all your traffic on the target computer comes from one place.
Since they are on two different blocks, you will want to make sure that something like IP tables (firewall) will not block all access on the target server, because you can connect to the site too quickly from the same IP address. If you do not control both networks, all kinds of things can also block re-access, such as firewalls and routers. Many web hosts do not like multiple large volumes of traffic. You can also be punished for bandwidth if you accidentally misconfigure any of them.
Database Replication If you are retrieving content from a database, you can view database replication and save two copies of the database on each machine. Then you just upload the contents, like any other file.