Posts Tagged ‘script sample’

A sim­ple PHP redi­rect script

September 16th, 2009
/* Redirect browser */
header("Location: http://theos.in/");
/* Make sure that code below does not get executed when we redirect. */
exit;

PHP — Remote Word­Press post­ing func­tion using XMLRPC

August 25th, 2009
function wpPostXMLRPC ($title, $body, $rpcurl, $username, $password, $categories=array(1)) {

	$categories = implode(",", $categories);

	$XML = "$title".
	"$categories".

	$body;

	$params = array('','',$username,$password,$XML,1);

	$request = xmlrpc_encode_request('blogger.newPost',$params);

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

	curl_setopt($ch, CURLOPT_URL, $rpcurl);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

	curl_setopt($ch, CURLOPT_TIMEOUT, 1);

	curl_exec($ch);

	curl_close($ch);

}

PHP — ‘Page last mod­i­fied’ on script

July 20th, 2009
<html>

<head>

<title>Page last updated on month/date/year hour:min PHP Script</title>

</head>

<?php

$last_modified = filemtime("myexamplepage.php");

print("Last Modified ");

print(date("m/j/y h:i", $last_modified));

?>

</body>

</html>