ActiveSocket Toolkit Add network capabilities to any Windows or .NET application

Quicklinks


How to use SCP in a PHP web page

ActiveSocket provides an easy-to-use development interface to a variety of IP protocols. By using ActiveSocket, you can very easily create or enhance applications with network features.

ActiveSocket features the following: DNS, FTP, HTTP, HTTPs, ICMP Ping, IP-to-Country, MSN, NTP, RSH, SCP, SFTP, SNMP v1/v2c (Get, GetNext, Set), SNMP Traps, SNMP MIB, SSH, TCP, Telnet, TFTP, UDP, Telnet, Wake-On-LAN and more.

ActiveSocket can be well integrated into PHP environments.

This document describes how ActiveSocket can be integrated into PHP projects.

Step 1: Download and install ActiveSocket

Download ActiveSocket from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.

Step 2: Create a form

To execute the telnet commands the user is going to give, you need to get the command from the user. We're doing that using a form. In this form we'll work with 4 fields.

  • One field for the command we're going to give (name : command)
  • One field for the location we want to send the command at (name : server)
  • One field for the port we want to send the command at (name : port)
  • And one field for the logfile (name : logfile)

You can make it look like this:

PHP

(Click on the picture to enlarge)

Create a form with the names listed above. To trigger the commands, we're going to set a variable in the url. In this sample we're using the variable "execute". You can fill in this variable using the action propertie in the <form> tag.

$objScp = new com("ActiveXperts.Scp");

echo "ActiveSocket Version " . $objScp->Version . "; Build " . $objScp->Build . "; Module " . $objScp->Module . "<br />"
echo "Expiration date: " . $objScp->ExpirationDate

Full Sample Code

There are scp samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/network-component