logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Failed to open stream error
Author
matleeds



Joined: 25 Aug 2011
Posts: 1

PostPosted: Thu 25 Aug '11 13:07    Post subject: Failed to open stream error Reply with quote

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,
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sat 27 Aug '11 13:33    Post subject: Reply with quote

To what is allow_url_fopen set in your php.ini?
Back to top


Reply to topic   Topic: Failed to open stream error View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner