Dear reader,
I am trying to read a XML file (made by an application via c#) into PHP.
Whatever I try it won't work
What I have tried:
This is the code;
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$myXMLData = $_GET["C:\ProgramData\DS\Config.xml"];
$xml=simplexml_load_string($myXMLData);
$connectionInfo = array( "Database"=> $xml->DatabaseConnection[0]->InitialCatalog, "UID"=> $xml->DatabaseConnection[0]->UserID, "PWD"=>$$xml->DatabaseConnection[0]->Password);
$conn = sqlsrv_connect( $xml->DatabaseConnection[0]->DataSource, $connectionInfo);
if( $conn ) {
echo "Connection established. <br/><br/>
";
}else{
echo "Connection could not be established.<br /><br>";
die( print_r( sqlsrv_errors(), true));
print_r(PDO::getAvailableDrivers());
}
?>
This is the erorr code;
Notice: Undefined index: C:\ProgramData\DS\Config.xml in B:\_Websites\testpage.php on line 68
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 72
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 72
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 72
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 72
Notice: Undefined variable: in B:\_Websites\testpage.php on line 72
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 72
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 72
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 73
Notice: Trying to get property of non-object in B:\_Websites\testpage.php on line 73
Connection could not be established.
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -1 [code] => -1 [2] => Invalid option was passed to sqlsrv_connect. [message] => Invalid option was passed to sqlsrv_connect. ) )