this what i use as you can see ive used curl before or you can use file_get_contents
all it is is function to read data from template ex insert php data into the page templates,
you have global data and then you have page by page data
/////GLOBALS WHAT/////
$global_what = Array(
'baseaddr',
'action',
'mode',
'directory',
'images',
'sitename',
'site',
'sitecolor',
'shadow',
'username',
'uid',
'mobads',
'mobads2',
'ipaddress',
'browser',
'email',
'mysql_error'
);
/////GLOBALS WITH/////
$global_with = Array(
$baseaddr,
$action,
$mod,
$directory,
$images,
$sitename,
$_SESSION['sitename'],
$_SESSION['navcolor'],
$_SESSION['sitecolor_shadow'],
$_SESSION['username'],
$_SESSION['uid'],
"<a href=\"http://info.wapdesire.com\">click here for help</a>",
"<a href=\"http://info.wapdesire.com\">click here for help</a>",
ip(),
browser($_SERVER['HTTP_USER_AGENT']),
fetch_array("email",members,"id = 1"),
$mysqlerror
);
function Template($what, $with, $temp)
{
global $global_what,$global_with;
if (!is_file("./templates/$temp.xhtml")) error("file not found!");
$data = file_get_contents("./templates/$temp.html",1);
/*
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, "http://www.wapdesire.com/templates/$temp.html");
curl_setopt($cURL, CURLOPT_HEADER, 0);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($cURL);
curl_close($cURL);
*/
foreach($what as $getvar) $What[] = "{".$getvar."}";
$data = str_replace($What, $with, $data);
foreach($global_what as $getvar) $Global_what[] = "{".$getvar."}";
$data = str_replace($Global_what, $global_with, $data);
print $data;
}