What I am going to show you is how to edit pages you don't own's HTML.
E.g:
If the background color is blue; the HTML will probably be:
Code:
<body bgcolor = 'blue'>
What this TUT will do is show you how to change something like that to make the background of the site, lets say, purple.
You must either have localhost, (I suggest XXAMP or Wamp for this (I use wamp)) or a website.
Step 1: You must open the webpage as a file:
Code:
<?php
$file = "SITE HERE";
$page = file($file);
?>
Step 2: $page is an array. So, you can't start editing yet. You will have to use the "foreach()" function:
Code:
foreach($page as $part) {
}
Step 3: Now, we can start editing the page. You will have to use the ereg_repalce() function to do so. ereg_replace is somewhat like str_replace.
Okay, lets say a sites html is:
Code:
<html>
<body bgcolor = 'blue'>
<h1>Welcome to this Site!</h1>
To make that page's background purple, and the message say "GET OUT!" you must use this script:
Code:
<?php
$file = "SITE HERE";
$page = file($file);
foreach($page as $part) {
$part = ereg_replace("<body bgcolor = 'blue'>", "<body bgcolor = 'purple'>", $part);
$part = ereg_replace("<h1>Welcome to this Site!</h1>", "<h1>GET OUT!</h1>", $part);
echo $part;
}
Okay, that will make the page's bg purple, and the welcome message say "GET OUT!". The parameters of ereg_replace() are:
ereg_replace(Original html, what to replace original html with, where to replace this info);
To get the html of a site, go to it, right click > View page source.
This is pretty much useless, but fun to mess around with. Hope you enjoy, if you have any problems tell me.