Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Telnet Using Fsockopen


I'm trying to telnet to a router to do a ping or trace job and retrieve the results. I tried this. PHP Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Fsockopen() And Telnet
I'm considering using a PHP command line script to retrieve reports from a
Linux system. My only source for the report is via telnet.

Has anybody here used fsockopen() to interactively script a telnet session
in PHP?

If so, what problems did you have to overcome. If not, does this sound
do-able?




View Replies !
Telnet Connection Using Fsockopen
I try to do a telnet script using diferent codes i find here, at the PHP website and other tring to connect to a server using telnet, do validation, and run a command getting the return. I dev over Win XP + Apache 2 + PHP 4.3. I start Telnet service to test aginst localhost machine. Code:

View Replies !
Warning: Fsockopen() [function.fsockopen]: SSL: Connection Reset By Peer In
I keep gettin this error when i submit on the form hosts say its all ok for them but isnt for me

Warning: fsockopen() [function.fsockopen]: SSL: Connection reset by peer in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

Warning: fsockopen() [function.fsockopen]:
php_stream_sock_ssl_activate_with_method: SSL handshake/connection failed in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

Warning: fsockopen() [function.fsockopen]: failed to activate SSL mode 1 in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

View Replies !
Telnet Example
I trying to create a telnet like program base on web page. Is there anyone have example about this ?

View Replies !
PHP Telnet
I have been reading all over the internet about this little problem that I have and I have decided to post it here. This is a nice place that has been helping me with my PHP projects so far. Code:

View Replies !
Telnet Via Php
I would like to telnet to a switch that supports telnet and issue some commands and dump the results back to the page. This is what I have so far for code:

View Replies !
Telnet
I am trying to write a script to take some info from a few variables
and use that info to telnet to a device and run a few commands, then
pipe the output to a file and name it. This would be placed into a
loop and run a number of times producing a number of files. I have not
been able to see if php can facilitate this. Can someone tell me how
they would go about this?

View Replies !
Telnet From Within PHP Scripts?
Does anyone know of, or have a good source of information where I can find out about doing telnet sessions from PHP or at least passing commands to a telnet process?

Am I pushing PHP beyond it's functionality?

Should I use some other application?

View Replies !
Php Script From Telnet?
Is is possible to run a php script from telnet?

View Replies !
Telnet Problem With PHP
I'm writing a little script for reading information from a router by telnet.
I have a problem

How give a comand and get the answer more times?
I means:

[...]
$usenet = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
[...]
fwrite ($usenet, "show interface description

");
[...]
while (!feof($usenet))
{
$r1=fgets($usenet, 1000)."<BR>
";
}

View Replies !
Anyone Know Of A Telnet Class?
I'm looking for a PHP telnet class similar to Perls net::telnet and net::telnet::cisco modules. I'm not looking for a scripts like Pcom that run commands on the server itself, rather I need a class that will allow my scripts to telnet into routers and switches and download configs. I've got something but it's not ideal and was wondering if there were pre-built options.

View Replies !
Trying To Connect To Telnet?
I'm kind of new to php, and i want to connect to telnet on whois.nic.uk port 43
how would i go about doing this?

View Replies !
How To Open SSH/Telnet With PHP?
Web host does not have SSH/Telnet, but I read somethink like you can open a
SSHd or Telnetd with PHP or Perl. I am not sure if there will be an
interface via PHP/Perl so that it will sends commands via PHP/Perl and
display feedbacks, or it is just opens another process, but how, since there
is no root access.

View Replies !
Telnet & Run Commands Thru Http
I need do open a telnet session from a web page then pass a set 3 sets of command to it with a 5 second delay between each command the last command is to exit and close the telnet window
I really need help will this I have heard it can be done by sockets but iI have not used it before.

View Replies !
How To Send <ESC> To A Telnet Server??
I have been getting statistical rapports from a machine via a
telnet server. Until now it has been done manually. However
I want to automate the proccess, and scedule a PHP script to
run everyday.

Using my terminal, I give the command to order a rapport,
and then press <ESC>. Then the rapport is printed out.

Using a PHP script I can order a rapport, all works fine,
except I can not get the printout. When I try to send <ESC>
the telnet server responds with "syntax fault" so
I'm not doing it right.

I have tried the following:

View Replies !
Telnet Response Via PHP Sockets
I'm trying to develop a script that I can reuse to run remote commands
on multiple UNIX servers via telnet. I've tried various php scripts
after googling for a good 5 or so hours, but found no luck.

I've created a script (suprisingly) similar to the on found an old post
from 2001
(http://groups.google.com/group/php....5a3bb4ff13e6433)

function getResponse(&$socket) {

//Reading response
echo "Read response: ";

while ($buf = socket_read($socket, 2048)) {
//$output .= $buf;
echo $buf;
}

echo $output."";

return $output;
}

// Create internet socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

// Set 30 second timeout
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" =>
30, "usec" =0));

// Resolve hostname
$address = gethostbyname($host);

// Attempt connection
socket_connect($socket, $address, 23);

echo "Connected!";

// Send telnet Header 1
socket_write($socket, $header1, strlen($header1));
echo "Sent Header 1";
echo getResponse($socket);

//Header 2
socket_write($socket, $header2, strlen($header2));
echo "Sent Header 2";
echo getResponse($socket);

// Do more stuff here once its working...

socket_close($socket);
echo "Socket Closed";

echo $output;

The problem here, is that it doesn't make it past the first
socket_read(). I've even tried other methods using fread(), etc.

The same problem occurring is the response is only 2 characters (of
which are: ²$), and then the connection and script hang on the read
statement.

I've tried running this from a browser, from a command-line, but still
the same result. The only theory I have left, is that it has something
to do with the fact i'm running the script from a windows machine,
rather than a *nix one (This is because of availability issues :().

Can anybody suggest anything? Has anyone had the same problem? Simply
some proof that it works under *nix would be great.

View Replies !
Accessing Mysql Localhost(like With Telnet)
I have just successfuly installed php 4.0.4pl1 , apache 1_3_14, mysql-shareware-3.22.34
onto my computer running under windows ME.

Everything works fine..well so far that is. I have only done small simple tests so far. My question is how do i get access to mysql on my localhost the way i access mysql through telnet on my remote server. I think it's one of the many mysql.exe programmes in the mysql bin folder. But I dont want to mess where i'm not sure about.

View Replies !
CURL Telnet ( Remote Connectivity )
Is there anyway to connect to remote server in php, then executng some commands and display the output ? CURL supports TELNET , but didnt get any specific help from php sites and google. If anyone of you have used CURL with TELNET or any other way for connecting to remote server, then please let me know.

View Replies !
Problem With Stream (telnet To Router)
I have write a little script for connecting to cisco router BUT I have a
problem: I have to send to router all the commands and then I have to read
the output.
If I send a command1 and read the output for command1 the script works
well,
If I sent command1 , I send command2 and then I read output for command1
and command2 it works well.
If i send command1 and then I read the output for command1 then send
command2 I can't read the output for the command 2.
Why?
How can I do?

================================ SCRIPT ================================
<?
include "router.php";

$r=new Router();

$r->connect('router_address', $errno, $errstr);

$r->login($myLogin,$myPassword);

$o=$r->runCommand('sho ver'); //<==== works
echo '<pre>'
var_dump($o);
echo '</pre>'

$o=$r->runCommand('sho int descr'); //<==== don't works

$r->disconnect();

?>

View Replies !
How I Can SECURELY Password Protect A Directory Without Telnet
Does anyone know how I can SECURELY password protect a directory without telnet preferably using PHP?

View Replies !
Is It Possible To To Connect To A Server Via Telnet On Good Old Port 23?
Is it possible to to connect to a server via telnet on good old port 23?If yes, how??

View Replies !
Server2Server Transfer W/o FXP Support Or Telnet Access Possible?
there are reason I´m asking this: I have FTP access to 2 servers and want to transfer big files from one to another. Both don´t allow FXP transfer and I also have no telnet access. One server allows me to execute PHP and Perl Scripts, so I´ve searched around the web and came across some scripts that sounded interested for me:

With one script I can login via FTP via my web browser but I can only upload files from my local hard disk. Wouldn´t there be an option to upload via the server the script is actually running on?

The other script was a sideload script that could transfer via servers but logically, it has to be installed on the server where the files should be copied to and since I do not have ability to execute scripts from that server I want them to be uploaded/sideloaded.
Or maybe someone in here can name me a FWP (Free Webspace Provider) that allows $cripting and FXP transfer.

View Replies !
PHP Remote Include Fails - Telnet/web Browser Succeeds
I have a script that does a remote include (does not matter if I do
include(), file(), require(), etc, the result is the same).

The script spins for a long time and then will finally return (edited
for internet consumption):

Warning: blahFunction(http://www.someserver.org/header): failed to open
stream: Connection timed out in
/var/www/html/project/functions/myscript.php on line 28

Warning: blahFunction(): Failed opening
'http://www.someserver.org/header' for inclusion
(include_path='.:/usr/local/lib/php') in
/var/www/html/project/functions/myscript.php on line 28

I can succesfully run the same logic from a different server, and this
had been working prior to our move. If I telnet from the server to
"www.someserver.org 80" and issue a "get /header'" the expected result
comes back immediately. Also if I go to
"http://www.someserver.org/header" in my browser (the browser is not
being run from the server but same subnet) I get the results that I
expect back immediately.

Because of the move, I suspect it has to do with DNS issues. It's not
a matter of waiting for names to propagate as we are resolving them
internally and - as shown above - they do indeed resolve as expected.

I would buy it if you told me that I had a reverse-DNS issue - I just
don't know how to go about resolving it.

So I guess I'm asking

1: Does it seem like a reverse-DNS issue?
2: If it is, then how do I go about resolving it?
3: If it is not, then what are my other possibilities?

And just out of curiosity -

4: Why would telnet be able to resolve this correctly, but not PHP?
Especially since both are being tested from the same box.

View Replies !
Working With Plain Text Passwords In Shell/telnet Script
I've got a crafty script that uses a really nice little php telnet class to feed commands via telnet to a remote application. Part of the script, however, is logging in: once to the remote unix host, x-times into submodules of the application itself.

What is the best way to store these passwords so that at the time of execution, they're transmittable as plain text but so they're not easily retrieved via code source, db view, or external file view?

View Replies !
Using Fsockopen()
While using fsockopen(), to check a URL using:

$fp = fsockopen("$url", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "<br>The Link (URL) could ot be validated<br>
<b>You entered: $url</b><p>
<a href="../auth/user_edit.php">Please try again</a><p>";
exit();
}
else
{
// then it was successful!
fclose($fp); // and carry on
}

It does the job as expected
My message is displayed but also the following warning:

Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.asdfghjkl.com:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in C:wampwwwaaaaaurllinkssubmit_url.php on line 106

The rest (my message) is fine and required:

View Replies !
Fsockopen()
All variables are defined and the 'else{ $sendbody = ... blah, blah, blah,.... mail(vars) } works. It only has problems when the mail server is a remote host or I am attempting to connect via IP rather than use the mail command. If the first section is correct I am connecting, just not finishing session ($text91 says unable to connect, blah, blah, blah, etc...). Code:

View Replies !
IIS Fsockopen
My code here accesses an IIS server and returns

HTTP/1.1 400 Bad Request Server: Microsoft-IIS/5.0 Date: Fri, 16 Apr 2004
10:36:56 GMT Content-Type: text/html Content-Length: 87 The parameter is
incorrect.

what am i doing wrong? does anyone know what a valid http post header for
IIS would look like?


<?php
$fp = fsockopen("www.suedtirol.info", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />";
}
else
{
$out = "HEAD /XmlApi/Demo/SeekEngine.Get http/1.0";
$out .= "Host: www.suedtirol.info";
$out .= "Connection: Close";

fputs($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
//php fsockopen IIS error
?>

View Replies !
Fsockopen And SSL
I'm trying to open a socket to a web page that uses SSL. If I specify port 80 (obviously wrong, I know), I get an error stating that the page uses SSL, and that I should use https:// to specify the address. Of course, since I'm trying to open the page using fsockopen this doesn't help.

If I specify port 443 the script just times out. When I try the same script on a non-SSL page using port 80 it works great, so I know the basic script is ok. Is there any way to specify that you want to connect securely in the HTTP request header? I've been looking for info on this everywhere and haven't had any luck.

View Replies !
Fsockopen() Help
I'm trying to open, read and extract information from a website
(maximum and minimum temps from
http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt )... Could
anyone give me some direction in how to do this? Below is the code I
have written but i keep get given an 'invalid stream resource' error

<?php

$page = "www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt";
$time_limit = 60;
$file = fsockopen($page, $errno, $error, $time_limit);
if(!fp){
echo("Connection failure");
}
else
{
fputs($file, "GET / HTTP/1.0

");
while (!feof($file)){
$data[] = fgets($file, 1000);
}
fclose($file);
}
?>

View Replies !
Fsockopen Uses?
im interested in learning more about the fsockopen function, what are
some of the typical uses for this function?

View Replies !
PHP + Hi5 + Fsockopen
I need some ideias on this problem, it looks like this:

* I need to have a script that logs in hi5 with a given username/password [This one is already working]

* Then uploads pictures to the given username profile [??]

My doubt is, how can I keep the 2nd part of the script logged in so I can upload my picture? I need to do this with sockets, not using curl functions.

View Replies !
@fsockopen
here about time out settings.

@fsockopen ("IP", PORT, $errno, $errstr, .2)

Is the .2 a timeout length?  If so what are the limits on the value?  ex: .1 - .9 .

View Replies !
Should I Use Fsockopen Or Something Else?
Currently I am making a "tool" :) that will grab some websites source code and will search for a specified text (e.g. javascript codes) in it. I am using fsockopen function for connection to a website and it works great if the websites location is normal.

E.g. if the website starts at www.example.com then fsockopen works fine, but if the website uses auto-redirect(via Location header field) to www.example.com/en/ or www.example.com/login.php then it doesn work. It only shows the redirect pages headers.

Maybe you have some better ideas how to grab websites source code? I've heard that fopen is not working remotely with most servers..

View Replies !
Fsockopen
is there any way to test if fsockopen command is available to be used on my hosting server? my web hosts advise me that it is up and running (I had to pay extra to get a dedicated server to get the function) but im not too sure as I cannot connect to grab shoutcast stats using the function with a script i already have, which is my goal (I run a internet radio site), however if i upload exactly the same script to another server i use for another site to test it, it works without problem.

View Replies !
Fsockopen Via Ssl
I'm having issues attempting to create an ssl connection using fsockopen. my code contains the following line .

fsockopen("ssl://siteaddr",993,$errno,$errmsg,20);

error message reported:
Error: unable to connect to ssl://server.name.tld:993

When i tail the logs on the remote machine i see no connection attempts from the web server. it appears to die before attempting to make a connection attempt. Code:

View Replies !
Fsockopen Won't Timeout...
Hi,

i am using the following code to check a few ports on a few servers to see if they are up or down. But they never seem to time out, can someone tell me what to do pls?

View Replies !
Parse_url() And Fsockopen()
When i parse a url and use it in fsockopen() to retrive a file header sometimes i get an error that just keeps printing itself down the page until i hit "STOP" on my browser. It only happens when the url is something like:

http://sub.domain.thing.com/dir/folder/file/name.ext

with many subdomains and folders....How would i stop the error from occuring and possibly fix the problem?

View Replies !
Fsockopen Problem
Hi, I am trying to complete a post using fsockopen but I'm getting the
following error:

"Unable to find the socket transport "ssl" - did you forget to enable
it when you configured PHP?

I am running php 5.1.4 with apache 2 on fedora core 4. When I
configured php I did it like this:
../configure --with-apxs2=/usr/sbin/apxs --with-mysql

All I'm trying to achieve is to get a response from the neteller test
server, the response will be an error as the numbers I'm sending it are
garbage, but I'm not bothered about that, I just want to be able to
send the request and get the response back. I've searched google for a
while but can't figure out why my code isn't working, I know there were
problems with windows platforms with php4 but obviously, that is not an
issue here...


Thanks in advance, my code is below...

View Replies !
Posting With Fsockopen ?
I am trying post article using fsockopen. Even though i can connect to the server, i am keep getting this error message when ever i try to post something.

Warning: Supplied argument is not a valid File-Handle resource in
/user/php/send.php on line 19

View Replies !
Odd Fsockopen Behavior
Any IP address I try to open with fsockopen on a particular server
seems to use another IP address instead.

eg. I open a socket connection to 192.168.1.1 but the remote_addr that
the other server sees is 192.168.1.255. It's as if, like I said, the
IP address I supply to fsockopen is being replaced with another one.

Anyway, this is breaking a script of mine. I don't think I can really
do a lot in PHP to fix this but is there perhaps some way that I can
detect it? Is there some command line parameter that I can pass to
passthru or something that'll tell me whether or not such a thing is
happening?

Also, how is this even being done? Could a firewall do this? If so,
I'm still not even sure how it'd be done...

View Replies !
Local Fsockopen()
I am tring to develop a site that conects via sockets. I am doing the development on a localhost Apache server here's a small code example:-

<?php
$host="127.0.0.1";
$socket=fsockopen($host,80,$errno,$errstr,50);
if(!$socket){echo "NO CONNECTION".$errno.$strerror;}
else
{ fputs ($socket, "GET/apache/htdocs/phpinfo.php HTTP/1.1");
$info=''
while (!feof($socket)) {
$info.=fgets($socket,1024);}
fclose ($socket);
echo $info;

I'm having a problem with the fputs() line. After the GET/ sataement I am trying to direct he socket to a file, so I will be able to read/write but the fputs() doesn't seem to accept any path I put into it. The socket works ok because If I leave out the path I am sent o the apache intro page on my localhost.

View Replies !
Request Fsockopen
I'm having a problem with fsockopen function, I'm programming with php
4.3 and need to do an HTTP POST over secure socket, ssl, here's my
code:

$context = stream_context_create();
$result = stream_context_set_option($context, 'ssl', 'local_cert',
"/certificate/cert.pem");
$result = stream_context_set_option($context, 'ssl', 'passphrase',
"passphrase");

$sock = fsockopen("ssl://myhost", 443 , $errno, $errstr, 30, $context);
if (!$sock) die("$errstr ($errno)
");

I get this error when trying to run this code:
Warning: fsockopen(): Unable to set local cert chain file
`/certificate/cert.pem' Check that your cafile/capath settings include
details of your certificate and its issuer in /path/to/file.php on line
xxx

Dunno what to do, I thought there's something wrong in my certificate
but couldn't find any real explanation on google or php site,

View Replies !
GET Request W/fsockopen()
The following function retreives a GET request. It works great with many
sites (exp. www.msn.com), but others just hang (exp. www.ebay.com) or return
an error (exp. www.microsoft.com).

I've tried adding additional headers like "Referer" and "Accept", but it
doesn't make a difference.

What needs to be done to satisfy those web servers that won't cooperate?

$link = "http://www.domain.com?param1=string";

$http_response = "";
$url = parse_url($link);
$fp = fsockopen($url[host], 80, $err_num, $err_msg, 30) or die("Socket-open
failed--error: ".$err_num." ".$err_msg);
fputs($fp, "GET /$url[path]?$url[query] HTTP/1.0
");
fputs($fp, "Connection: close

");
while(!feof($fp)) {
$http_response .= fgets($fp, 128);
}
fclose($fp);
echo $http_response;

View Replies !
Using Fsockopen() And Fputs()
I'm using fsockopen() function to establish connection with server. After I have loop which generate passwords inside that loop I have fputs() to make request to the server and ‘echo’ for testing of my password combination. Since I can see all password combination my loop is working OK, but fputs() it make only one request. Code:

View Replies !
FsockOpen With Http 1.1
I have the following code that needs to be transferred into HTTP 1.1 I am running on windows and wondered if this is an easy undertaking and what to beware of from user experience. PHP Code:

View Replies !
Fsockopen Errors
In the code fragment below $errno and $errstr get set to the
system-level errno and strerror() from the connect() call. Does anyone
know what the errors below mean an how I may rectify them?

$fp = fsockopen($host, $port, $errno, $errstr, 30);

Here are the resulting errors I get regardless of what I specify for
$host:

$errno = "115"
$errstr = "Operation now in progress"

View Replies !
Fsockopen Error Need Some Help Thanks
I am using php version 4.3.9 and lets say i have a file on the server
called tester.php

so i am using fsockopen to point to that file but it gives me a error below.

$fh = @fsockopen("http://www.mysite.com/teter.php", "80", $errno, $errstr,
180);

111 Connection refused

This server is linux Redhat Enterprise with Apache 2.x

Is there anything i need to edit in the php.ini file or apache file.

View Replies !
Fsockopen And Redirect?
I'm attempting to write a script that pulls a list of URLs from my database, checks to see what the last modified date of that URL is, and updates the database with each URL's new last modified timestamp. It's working in most cases right now, but it seems fsockopen can't handle redirects very well according to some google searches.

This is especially problematic because most of the URLs I'm checking are RSS feeds and a lot of them redirect to feedburner now for analytics. Code:

View Replies !
Fsockopen Slow
I'm having an issue with speed at the moment. Basically I have a database with a list of websites on it. I only want to display the sites that are actually 'live'. I've used fsockopen and it does work. Only problem is it takes quite a while.

I seem to be waiting at least 10 seconds for it to tell me the site is not responding. It is very quick when the site does exist though. I've played with the optional timeout from fsockopen but I see no difference. Any suggestions? Is there another faster way to check a site is online using php?

View Replies !
POST And Fsockopen()
What I have done is change from one autoresponder company to another I have exported my email lists from previuos company.Now what happens is if I POST via a WEB FORM that email goes into the lead list and no verification s sent to my lead.

If I add by fsockopen() the lead is added to my lead list but a confirmation email is sent to my lead. This I want to prevent cause I have changed before and I donot want to get a impression with my leads. Code:

View Replies !
Fopen / Fsockopen
I want to write a simple PHP code to verify whether a given list of URLs is broken or not. The URLs given have various formats, for example .....

View Replies !
Curl Vs Fsockopen
I' m developping a web page html parser. For now I get the page using fsockopen. A friend of mine advised me to use curl, but I don' t really understand why it would be better using curl.

That' s why I ask the question :

what are the differences between fsockopen and curl?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved