[php]<?PHP
session_start();
require(‘config.php’);
// Generating url for api request
$url = APIURL;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
if( !empty($_POST[‘posted’]) ){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
}
if (!($contents = trim(@curl_exec($ch)))) {
$contents = trim(file_get_contents($url));
}
curl_close ($ch);
echo $contents;
?>[/php]
I have this block of PHP for my index page and it generates and creates my pages for that particular site. It writes files and copies images to my directory where the PHP file is. I use the copy and unlink functions to move my files & images between the folders, and it all works great.
Now I want to take it a step further. Is there a way to save the files that are being written to the new domain? My current problem is that when I place the index file on my new domain, the files get generated where the API file is. Overall, how can I get the files to be saved to the new domain root folder.
Best Regards,
Josh