So i have this cron.php to do some tasks every 15minutes. Cron works fine, but something is wrong with my php code and i cant figure it out.
I want to copy the remote xml file to local folder (this works), then, parse thru the xml file and get all display_name and image_url values. Then, create local folder with username and copy its thumb there... how hard can this be? i've been at it for past 5 days :(
Can you help?
#!/usr/local/bin/php -f
<?php
// Copy remote xml to local dir
copy ('http://www.remoteweb.com/api/?format=xml', '/includes/cache/feed.xml');
// connects to xml
$xmlor = '/includes/cache/feed.xml';
$doc = New DOMDocument();
$doc->load($xmlor);
// gets xml values as vars
$resource = new SimpleXMLElement($xmlor, null, true);
foreach( $doc->getElementsByTagName('display_name') as $user ) {
// create dir with username
if (!file_exists('/includes/cache/_thumbs/'$user'')) {
mkdir('/includes/cache/_thumbs/'$user'', 0755, true);
}
foreach( $doc->getElementsByTagName('image_url') as $thumb ) {
// copy user thumb to user folder
copy ($thumb, '/includes/cache/_thumbs/'$user'');
}
}
?>