PHP to read data from local machine

Hello

I am fairly new to PHP, so please bear with me:

I am trying to write a php script that would read a text document on one machine and send that to Adobe Flex such that it would put that data into the appropriate fields.

I already have the connection between php and flex sorted out. But my only problem is trying to read the data on one’s computer.

This is what I have so far: (note I am doing this on a windows machine)

<?php
	// get contents of a file into a string
	$filename = "C:\Documents and Settings\me\Desktop\stationText.txt";
	$return .= "<fileOpen>";
	$handle = fopen($filename, "r");
	
	if( $handle == false)
		die("unable to open File");
	
	$contents = fread($handle, filesize($filename));
	fclose($handle);

	$return .= "<viewData>".$contents."</viewData></fileOpen>";
	echo $return;
?> 

Note: I am sending the data to XML, such that it could be read in Adobe Flex (that part works as long as the fopen works)

Another Note: I am writing this to pass data to Flex 2.

Any help would be much greatly appreciated

Sponsor our Newsletter | Privacy Policy | Terms of Service