Fsockopen() function??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FiOh
Forum Commoner
Posts: 39
Joined: Tue Dec 12, 2006 12:20 am

Fsockopen() function??

Post by FiOh »

Hi I'm new here.

I run my program and gets an error but i do not understand it.
Does anyone know what does the error below mean?

Code: Select all

Warning: fsockopen() [function.fsockopen]: unable to connect to 172.16.221.214:23 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\Program Files\Apache Group\Apache2\htdocs\Multivendor_D\cisco2612\Login_Process.php on line 20

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Group\Apache2\htdocs\Multivendor_D\cisco2612\Login_Process.php on line 20
Thanks for replying.
*^^*
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The address (and port) you are attempting to connect to refused your request, did not respond to your request, or responded with malformed data.
FiOh
Forum Commoner
Posts: 39
Joined: Tue Dec 12, 2006 12:20 am

Post by FiOh »

Is the error caused by improper connection between the devices?
Sorry if i sounds stupid.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Can you hit that port and address normally?
FiOh
Forum Commoner
Posts: 39
Joined: Tue Dec 12, 2006 12:20 am

Post by FiOh »

Everah wrote:Can you hit that port and address normally?
Sometimes when i try to ping to the address of the device using command prompt, it can ping to the address of the device successfully. But when i go to the php program to run the program, i will get the error below:

Code: Select all

Fatal error: Maximum execution time of 30 seconds exceeded in .....
I'm at a blur now... right now i can ping to the switch as well as login to the php program to configure the switch but i am not able to ping to the router nor login to the php program to configure it.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Well first Testing Pinging it Through php
============================

Code: Select all

<?php
$output = shell_exec('ping 172.16.221.214');
echo $output;
?>
I also have a doubt about the port number try to ping with that port "23"
FiOh
Forum Commoner
Posts: 39
Joined: Tue Dec 12, 2006 12:20 am

Post by FiOh »

neel_basu wrote:Well first Testing Pinging it Through php
============================

Code: Select all

<?php
$output = shell_exec('ping 172.16.221.214');
echo $output;
?>
I also have a doubt about the port number try to ping with that port "23"

On which page and where should i put the above codings to try pinging through the php?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I think it's more likely that your host are blocking traffic on your account. That's quite common.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

FiOh wrote:
neel_basu wrote:Well first Testing Pinging it Through php
============================

Code: Select all

<?php
$output = shell_exec('ping 172.16.221.214');
echo $output;
?>
I also have a doubt about the port number try to ping with that port "23"

On which page and where should i put the above codings to try pinging through the php?
just make a .php scrit contain this code and the run it in your browser
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

neel_basu wrote:just make a .php scrit contain this code and the run it in your browser
You might want to say 'call the page from the server' as running a PHP file in your browser will just show the code.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

I was trying to make Sure Wheathere he is getting reply or not while pinging
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I am aware of that. But the php file still needs to be parsed through the server in order to execute the code, and loading/running it in the browser is a little misleading. It sounds like you mean ctrl-O to open the file rather than calling the URI http://localhost/file_name.php.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

oh! :roll: sorry but I think He would Understand it after this Replies
FiOh
Forum Commoner
Posts: 39
Joined: Tue Dec 12, 2006 12:20 am

Post by FiOh »

I have created a .php page with the codings to test the pinging through php and below is the message i got:
Pinging 172.16.221.214 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 172.16.221.214: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

So Its Not Replying In The Ping There May Be Some faults between thease 2 machines
Post Reply