Discussion:
fopen, fsockopen on my virtual host
Al
2005-01-31 17:05:35 UTC
Permalink
I've got a script that fetches a stream from a file on our virtual host. Its
been working fine; but, yesterday they changed something and it no longer works.

$fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30);

I can use any remote site and fscockopen works fine.

Anyone have a suggestion as to how I deal with this problem?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Lynch
2005-01-31 17:57:59 UTC
Permalink
Post by Al
I've got a script that fetches a stream from a file on our virtual host. Its
been working fine; but, yesterday they changed something and it no longer works.
Can you define "no longer works" a bit more clearly...

Error messages?

Just times out?

What?
Post by Al
$fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30);
I can use any remote site and fscockopen works fine.
Anyone have a suggestion as to how I deal with this problem?
if ($errno){
error_log("fsockopen errored out with # $errno: $errstr");
}
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Al
2005-01-31 18:44:03 UTC
Permalink
Post by Richard Lynch
Post by Al
I've got a script that fetches a stream from a file on our virtual host. Its
been working fine; but, yesterday they changed something and it no longer works.
Can you define "no longer works" a bit more clearly...
Error messages?
Just times out?
What?
Post by Al
$fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30);
I can use any remote site and fscockopen works fine.
Anyone have a suggestion as to how I deal with this problem?
if ($errno){
error_log("fsockopen errored out with # $errno: $errstr");
}
Warning: fsockopen(): unable to connect to www.restonrunners.org:80 in /www/r/reston/htdocs/phpList/PQ/PQutility.php on line 364
Operation timed out (60)
fsockopen() works fine with remote URLs and even "localhost"; but, not with our
own URL.

I'd use "localhost" but, I need to attach some GET arguments and I can't figure
out a way to do it. e.g.,

$str= file_get_contents(localhost?page=processqueue&login=Pmin&password=xxxxx)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jochem Maas
2005-01-31 19:17:35 UTC
Permalink
...
Post by Al
$str=
file_get_contents(localhost?page=processqueue&login=Pmin&password=xxxxx)
$str = file_get_contents('http://localhost/?page=processqueue&login=Pmin&password=xxxxx');
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Lynch
2005-01-31 20:19:48 UTC
Permalink
Post by Al
Post by Richard Lynch
Post by Al
I've got a script that fetches a stream from a file on our virtual host. Its
been working fine; but, yesterday they changed something and it no
longer
works.
Can you define "no longer works" a bit more clearly...
Error messages?
Just times out?
What?
Post by Al
$fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30);
I can use any remote site and fscockopen works fine.
Anyone have a suggestion as to how I deal with this problem?
if ($errno){
error_log("fsockopen errored out with # $errno: $errstr");
}
Warning: fsockopen(): unable to connect to www.restonrunners.org:80 in
/www/r/reston/htdocs/phpList/PQ/PQutility.php on line 364
Operation timed out (60)
fsockopen() works fine with remote URLs and even "localhost"; but, not with our
own URL.
I'd use "localhost" but, I need to attach some GET arguments and I can't figure
out a way to do it. e.g.,
$str=
file_get_contents(localhost?page=processqueue&login=Pmin&password=xxxxx)
Put some quotes on that, and http:// on the front, and it should work as-is.

Your own domain not working is a symptom of something else though...

Can you ping restonrunners.org?

What happens if you try to do this in a shell:
telnet restonrunners.org 80
GET / HTTP/1.0
Host: restonrunners.org


Hit 'return' twice after the 'Host:' line.

You should get your homepage.

You may have some firewall mis-configured, or DNS issues, or /etc/hosts
might be messed up or...

Many things *could* be wrong to cause this, but none of them are really
PHP-related.
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Al
2005-02-01 14:45:24 UTC
Permalink
Post by Richard Lynch
Post by Al
Post by Richard Lynch
Post by Al
I've got a script that fetches a stream from a file on our virtual host. Its
been working fine; but, yesterday they changed something and it no
longer
works.
Can you define "no longer works" a bit more clearly...
Error messages?
Just times out?
What?
Post by Al
$fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30);
I can use any remote site and fscockopen works fine.
Anyone have a suggestion as to how I deal with this problem?
if ($errno){
error_log("fsockopen errored out with # $errno: $errstr");
}
Warning: fsockopen(): unable to connect to www.restonrunners.org:80 in
/www/r/reston/htdocs/phpList/PQ/PQutility.php on line 364
Operation timed out (60)
fsockopen() works fine with remote URLs and even "localhost"; but, not with our
own URL.
I'd use "localhost" but, I need to attach some GET arguments and I can't figure
out a way to do it. e.g.,
$str=
file_get_contents(localhost?page=processqueue&login=Pmin&password=xxxxx)
Put some quotes on that, and http:// on the front, and it should work as-is.
Your own domain not working is a symptom of something else though...
Can you ping restonrunners.org?
telnet restonrunners.org 80
GET / HTTP/1.0
Host: restonrunners.org
Hit 'return' twice after the 'Host:' line.
You should get your homepage.
You may have some firewall mis-configured, or DNS issues, or /etc/hosts
might be messed up or...
Many things *could* be wrong to cause this, but none of them are really
PHP-related.
You are correct, the problem is due to the host switching to "load balancing"
servers.

Required syntax is now fsockopen("localhost.domain.com", port, time) and
$string= file_get_contents("http://localhost.domain.com/path").

Thanks again....
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Al
2005-01-31 19:16:04 UTC
Permalink
Post by Richard Lynch
Post by Al
I've got a script that fetches a stream from a file on our virtual host. Its
been working fine; but, yesterday they changed something and it no longer works.
Can you define "no longer works" a bit more clearly...
Error messages?
Just times out?
What?
Post by Al
$fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30);
I can use any remote site and fscockopen works fine.
Anyone have a suggestion as to how I deal with this problem?
if ($errno){
error_log("fsockopen errored out with # $errno: $errstr");
}
Same, only a minor typo correction
Post by Richard Lynch
Warning: fsockopen(): unable to connect to www.restonrunners.org:80 in /www/r/restonrunners/htdocs/phpList/PQ/PQutility.php on line 364
Operation timed out (60)
fsockopen() works fine with remote URLs and even "localhost"; but, not with our
own URL.

I'd use "localhost" but, I need to attach some GET arguments and I can't figure
out a way to do it. e.g.,

$str= file_get_contents(localhost?page=processqueue&login=Pmin&password=xxxxx)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
n***@ridersite.org
2005-01-31 19:31:06 UTC
Permalink
This message was cancelled from within Mozilla.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...