php
7 TopicsAuto updates GeoIP database on Big IP.
Problem this snippet solves: Securely, auto updates multiple Big IP's, geoip database. Tested on Version 12.1.2, but should work for others. How to use this snippet: Must have PHP installed (tested on 7.0, 5.6 should work too) Install (on Ubuntu Server 12.04-16.04) sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php sudo apt-get -y install php7.0 php7.0-common php7.0-cli php7.0-curl php7.0-mcrypt php-ssh2 php-zip Then just issue on the CLI: php geoip_updater.php <downloads.f5.com https geoip file url - on location page> <optional, md5 file url> Modify script to enter your servers ip, hostnames, and Auth settings. Testing updating 8 BigIP's, in under 5 minutes. Due to limitations in how the file is offered on downloads.f5.com, you have to get the filename before running the script. Code : http://bit.ly/2uqeAI5 Tested this on version: 12.12.3KViews0likes10CommentsGetting Started with iControl and PHP
Problem this snippet solves: After a few years of trial and error, I've managed to learned the ins and outs of using the iControl API with PHP. It certainly wasn't an easy process, as the information available was few and far between. So.... Here it is!! iControl and PHP For this first example, we will build a PHP script that will query an LTM for all of the pools and members along with their availability status and connection counts. The first step in the script is to create a few variables for storing the username, password, and LTM IP address. We will also define the necessary WSDL objects for interacting with iControl. Code : "; echo ""; $sn = $_SERVER['SCRIPT_NAME']; echo " ";?>547Views0likes1CommentUsing PHP to connect to iControl REST interface
Problem this snippet solves: Using PHP 7 (and newer) with the GuzzleHttp library to connect to the REST interface. How to use this snippet: Install the GuzzleHttp library if you need to and include the autoloader. This is a regular step or process for any modern PHP application. Code : Tested this on version: 12.1274Views0likes0CommentsiControl examples in PHP5
Problem this snippet solves: PHP5 SOAP client web page widget examples to manipulate LTM Nodes, Pools, PoolMembers (deprecated), Virtual Servers, GTM Servers, Virtual Servers, WIP Pools, and WIPs. How to use this snippet: PHP5 SOAP client web page widget examples to manipulate LTM Nodes, Pools, PoolMembers (deprecated), Virtual Servers, GTM Servers, Virtual Servers, WIP Pools, and WIPs. function get_statistics($vs) { try { $soapClient = getSoapClient(); add_result("called LocalLB::VirtualServer::get_statistics",true); if(is_array($vs)) { return $soapClient->get_statistics($vs); }else{ return $soapClient->get_statistics(array($vs)); } }catch (Exception $e) { add_result("Error:".formatErrors($e->getMessage()),true); } }386Views0likes1CommentPIPer - PHP iControl Portal
Problem this snippet solves: This is a simple iControl portal that provides a user-authenticated portal based on PHP SOAP for F5 devices. There are two files - PIPer_v1_Server.zip - a Windows-ready WAMP server based on UniformServer (www.uniformserver.com) and including the PIPer portal code. Note: Due to upload size limits I can't publish this here. I will try to find a different place to publish this. Feel free to contact me if you want me to send you the file. PIPer_v1_PHP.zip - just the PIPer PHP code. Note that this is required to be installed on a PHP-enabled web server that includes SOAP and SQLite3. To use the Windows-ready version, extract the zip file to a directory and double-click the Start.exe executable. Accept any Windows Firewall notices and a blue box icon with a 1 will appear in the system tray. Click on the icon and select Start UniServer. The server should start and open the PIPer home page (http://localhost). Login with admin and admin and add users and elements from the Admin page. The action page shows details of the device such as software and hardware version, Virtual Servers, Pools, Nodes, etc. You should not run this in a production or secure environment. Code : 46551,46569268Views0likes3CommentsPHP iControl Object State
Problem this snippet solves: This is a single PHP page which, when opened first shows a form in which the user enters the username, password and address, hit Submit and the script logs in to the device via iControl and shows virtual servers, pools, pool members and nodes along with state and connection numbers, etc. Many thanks to the various contributors that I have stolen borrowed this from, especially Getting Started with iControl and PHP iControl-PHP WAMP Server Attached is a WAMP server with this file included - based on Uniform Server. To use this, download the zip file and extract to a relevant directory. - Click on Start.exe which creates a System Tray icon (blue with a white 1). - Left click on this and go to "Start UniServer (Apache MySQL)" at the top. - Then navigate to http://localhost and use the form. (Note that you can install this as a service by right-clicking on the icon and going to "Install and Run All Services". To stop the server, left-click on the icon and go to "Stop UniServer (Apache MySQL)". To remove the System Tray icon, left-click and go to Exit Code : "; echo " "; echo " "; $sn = $_SERVER['SCRIPT_NAME']; echo " ";?> "; echo " "; echo " LTM Device View "; if ($message = "SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://".$username.":".$password."@".$address."/iControl/iControlPortal.cgi?WSDL=LocalLB.Pool'") { echo " Error: There is an issue with connecting to this device It could be because of "; echo "an issue with routing to the device, or with the username/password."; echo " \n Check the IP address, username and password entries are correct "; echo " Check connectivity to the device using ping "; echo " Check that there are no firewalls in the way, or that they allow HTTPS on port 443 "; echo " Check that the device has a functional license \n "; echo "Home Page"; } else { echo " Error: $message"; echo " Home Page"; } } } if ($_SERVER['REQUEST_METHOD'] == 'GET') { echo " BIG-IP LTM Status "; echo " "; echo " "; echo " LTM Device View "; echo ""; echo " \n"; echo " Username: \n"; echo " Password: \n"; echo " Host IP address or name: \n"; echo " \n "; } ?>41Views0likes0CommentsiControl Examples from Agility Conference 2011 in PHP
Problem this snippet solves: These are PHP web pages which can be used to manipulate nodes, pools, virtual servers, GTM wideip pools, GTM servers, GTM virtual servers, and GTM wide IPs. You can extract them to a PHP enabled web server near you. Make sure it is PHP5 and has SOAP commands built in.276Views0likes0Comments