Interesting but, HTML out has no error while UNIX output does
//// Here’s the script ////////////////
[php] //PHP Code: [Select] by w@tt 7 Mar. '13
echo 'L.3 watt_test.php ’ . date('l dS \of F Y h:i:s A ’ . ‘
’);
include_once ($_SERVER{'DOCUMENT_ROOT'} . '/.../SMTP4PHP.php');
$results = array();
try {
$fh = @fopen($_SERVER{‘DOCUMENT_ROOT’} . ‘/…/kvpisow2.txt’, “r”);
while(($buffer = fgets($fh, 4096)) !== false) {
$kvp = preg_split ("/[\s,]+/", $buffer);
$index = array_shift($kvp); // shift the first element to use as array index
$results[$index] = implode(" ", $kvp); // implode remaining elements
//$results[$kvp[1]] = $kvp[3] . " " . $kvp[4] . " " . $kvp[5] . " " . $kvp[6] . " " . $kvp[7] . " " . $kvp[8];
}
fclose($fh);
}
catch(Exception $e) {
exit('Exception caught: ’ . $e->getMessage());
}
var_dump($results);
[/php]
////////// Here’s the HTML output ////////////////////
L.3 watt_test.php Friday 08th of March 2013 08:51:08 AM
array(1) { [“Key”]=> string(18) “ZI Value Zimbabwe " } // //if ($fh) { // // while(($buffer = fgets($fh, 4096)) !== false) { // // $kvp = preg_split (”/[\s,]+/", $buffer); // // $results[$kvp[1]] = $kvp[3] . " " . $kvp[4] . " " . $kvp[5] . " " . $kvp[6] . " " . $kvp[7] . " " . $kvp[8]; // // }
//////////// and here’s the UNIX output w/ its error mssg ////////////
u-sit@lsh1001:~/…b/usit2013$ php watt_test.php;
L.3 watt_test.php Friday 08th of March 2013 08:50:02 AM
PHP Warning: include_once(/…/SMTP4PHP.php): failed to open stream: No such file or directory in /…/usit2013/watt_test.php on line 4
PHP Warning: include_once(): Failed opening ‘/…/SMTP4PHP.php’ for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in /…/watt_test.php on line 4
PHP Warning: fgets() expects parameter 1 to be resource, boolean given in /…/watt_test.php on line 11
PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /…/watt_test.php on line 19
array(0) {
}