Pull DATA from XML and set the variables in PHP to perform the function for FTP data

I am a novice and totally confused ... trying to pull the DATA from XML and set the variables in PHP to perform the function for FTP data.sample xml:\[code\]<?xml version="1.0" standalone="yes"?><dataroot xmlns:od="urn:schemas-microsoft-com:officedata"><ID>1</ID><mywesitehere</ftp_website><ftp_server>ftpserverhere</ftp_server><ftp_user_name>userhere</ftp_user_name><ftp_user_pass>passhere</ftp_user_pass>\[/code\]Here's a PHP file with a function, but clearly something I messed up (the idea is to take the bags DATA from an XML file, and use of in PHP:\[code\] <?php $xml = simplexml_load_file('websiteftpdetails.xml'); foreach($xml_object->children() as $child) { print $child . "" . " <br />"; foreach($child->attributes() as $attr) { print $attr .""; } foreach($child->children() as $subchild) { print $subchild .""; } } // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_website, $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_website, $ftp_server, for user $ftp_user_name"; } // close the FTP stream ftp_close($conn_id); ?>\[/code\]
 
Back
Top