matleeds 0 Newbie Poster

Hi there,

I'm a .net developer and I've inherited a partially complete php project. I'm trying get part of it running on my pc and am running into some issues due to my fairly limited knowledge with php/apache web server.

I'm using Windows Vista, I have Apache HTTP server 2.2 running and am using PHP 5.2.17.

The aim is to send some data to the web server.

I'm using this function below -

public static function push_data($data)
{
$data = base64_encode(gzdeflate(ot::encrypt(serialize($data), otCRYPT_KEY), 9));
		$data = http_build_query(array(otDATA_KEY => $data));
		$opts = array (
			'http' => array (
				'method' => 'POST',
				'header'=> "Content-type: application/x-www-form-urlencoded\r\n"
					. "Content-Length: " . strlen($data) . "\r\n",
				'content' => $data
			)
		);
		$ctx = stream_context_create($opts);
		return file_get_contents(otDATA_URL, 0, $ctx);
	}

And am getting this message back -

PHP Warning: file_get_contents(http://localhost/Epointment/ot/backend/data.php): failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host failed to respond.

I've echoed $ctx and get Resource ID #15
and echoed otDATA_URL and get http://localhost/Epointment/ot/backend/data.php, which is correct.

I've run a test php script actually on the web server and it works, so at least I know the server is running
and PHP works on it.

I'm not sure if this is an issue with the Apache settings or the PHP script or php.ini settings

thanks for any help,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.