I have several niche price comparison sites where i need to update my productlist on a regular basis. When a merchant delivers his datafeed from his webserver(http://domain.com/feed.csv) you can use php's filecopy function.
Other merchants only offer an option to fetch there datafeed from an FTP server(ie shareasale merchants). This is where the code below offers [...]
If you want to add a feature to your website that shows the loading time of the page just impliment the code below.
Offcourse php is a serverside language so the result is the time needed to generate the html on the server. This does not include sending the page back to the browsers who [...]
This little php functions shows how to write the recursive XMLpath for all nodes that contain values.
PLAIN TEXT
XML:
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El ActÓr</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is [...]
This little scripts create's a backup of your database and website files at once and puts them on a folder on your webhosting.
PLAIN TEXT
PHP:
function backupDB($dbhost,$dbuser,$dbpass,$dbname, $sitename){
global $savepath , $date ;
$date = date("dmY");
if (!file_exists("$savepath/$date")) {
mkdir("$savepath/$date", 0777);
}
$filename = "$savepath/$date/SQL$sitename-$date.sql";
passthru("mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname>$filename");
}
PLAIN TEXT
PHP:
function backupWWW($wwwdirectory,$wwwname){
global $savepath , $date ;
if (!file_exists("$savepath/$date")) {
mkdir("$savepath/$date", 0777);
}
$filename = "$savepath/$date/WWW$wwwname.tar.gz";
$zipline = [...]
this is a prette neat trick:
$variable_name = "varname";
${$variable_name} = "this is the value";
echo $varname;