473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to create a telnet session using php?

Anyone can help me to do the following?
Im new to php as i had did it using python but i not sure how to write it in php as it does not have any telnet module.

Write a PHP code using proc_open()

the commands are
1. telnet 10.247.5.3
2. when login prompt, type xxx
3. when password prompt, type zzz.
4. run the command sh run.

thanks!
Mar 16 '12 #1
2 12480
dlite922
1,584 Expert 1GB
Checkout php.net/fsockopen.

Dan
Mar 16 '12 #2
Thanks Dan,

i had tried the following codes -->

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $ip = '192.168.x.x';
  3. $port = '23';
  4. $connect = fsockopen($ip,$port);
  5.  
  6. if(!$connect){
  7.     echo 'fail';
  8. }
  9. else{
  10.     echo 'pass';
  11. }
  12. ?>
  13.  
But how can i input the username and password ?
i had tried fwrite($connect, 'username'); but i dont seem to be working.
Mar 19 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Christian Wilcox | last post by:
I'm trying to programmatically access information from a telnet session which is normally accessed with a telnet program capable of terminal emulation (currently set at VT320). The initial login...
3
by: Yannick Turgeon | last post by:
Hello all, I'm currently trying to pass commands to a telnet session and get the texte generated (stdin + stdout) by the session. The problem I get is that the Telnet.read_until() function...
1
by: Michael | last post by:
Dear all, Given the following challenge: 1. The application is an exe on a W2K server 2. User logs via telnet to the server 3. After checking the user account and password, a bat file runs...
5
by: Greg Martz | last post by:
I'd like to do the following in C# and prefer using tcpclient rather than raw sockets... Connect to a unix box Login run date +%H%M%S retrieve the response. That's it, nothing more. This...
3
by: michael sorens | last post by:
I have searched extensively and have found only hints of what is needed so far: What I want to do is open a telnet session to a remote host on a given port, login, execute a simple command, and...
2
by: eight02645999 | last post by:
hi i am using a telnet session to simulate an authentication mechanism USER = "user" PASSWORD = "password" try: telnet = telnetlib.Telnet(HOST) telnet.set_debuglevel(5)...
1
by: mike11d11 | last post by:
Can anyone give me an example of how to use winsock control in a form, I'm trying to get a telnet session in one of my access database forms.
3
by: =?Utf-8?B?cGlja2VkYW5hbWU=?= | last post by:
Hi, I am trying to establish a telnet session to do screen scraping. This device returns some custom escape sequences, which I can ignore, and some standard escape seq's. At your suggestion, I...
1
by: Samuel | last post by:
Hi, I am trying to automate a telnet session (currently using Python's telnetlib) and would like to echo any response of the remote host to stdout, as soon as it arrives on telnetlib's open TCP...
3
by: Moogoo | last post by:
Hello all, I am new to c++, coming from a Java background. Thank you in advance for anyone that can answer the question below: GOAL: I am currently writing a shell application for a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.