cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
889
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Michael Schmidt on 30-05-2013 11:22:17 AM
Hi,

I want to build up a personal website maybe via PHP to execute after choosing something in this website some SQL command like

- select
- insert
- update
Is it possible to use these SQL commands direclty from a PHP website or should I open via the PHP homepage some Perl Scripts in which the SQL commands are?

Does anybody have a example PHP code with these mentioned SQL commands?
 
BR
Michael

Subject: RE: New Message from Michael Schmidt in AXL Developer - Administration XML
Replied by: Martin Sloan on 30-05-2013 11:37:34 AM
Hi Micheal,



You are traveling the same path I just came along!  I have some php code to help you out, I believe.  Here’s an example of pulling some user data from the CUCM EUDB and then firing another php script that ‘does something’, which is just more php code calling methods available via the AXL api using the info populated in the code below:



<?php

require_once("includes/database.php");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="style.css" />

</head>

<body>

<div id="container">

<form name="addUser" method="post" action="SOAP_addUser.php">

              <select name="userid">

                <option selected></option>

                 <?php

                 $client = CUCM::SoapConnection();

                 $sql = "select userid from enduser";

                 $response = $client->executeSQLQuery(array("sql"=>$sql));

                 foreach($response->return->row as $key=>$val) {

                    foreach($val as $newkey=>$newval){

                       $array[] = $newval;

                    }

                 }

                 sort($array);

                 foreach ($array as $valu) {

                   if (preg_match('/^Token/',$valu)) {

                       continue;

                     }

                   echo '<option>' . $valu . "</option>";

                 }

                 ?>

              </select>

           </form>



SOAP Database connection file:



<?php

  /**

   *Database Class

   *For access to CUCM

   */

class CUCM

{

  public function SoapConnection() {

    $client = new SoapClient("/var/www /schema/9.1/AXLAPI.wsdl",

                             array('trace'=>1,

                                   'exceptions'=>true,

                                   'location'=>"https://10.1.1.10:8443/axl/",

                                   'login'=>’Axl',

                                   'password'=>'password',

                                   ));

    return $client;

  }

}

?>

In the corresponding php file, in my case "SOAP_addUser.php", just gather the $_POST varialbes and use them in your code.  It’s always good to run web data through some sanity checkers to make sure nobody’s injecting malicious data into your system.  PHP has a bunch of them you can find with a quick google.



Some things to point out, make sure the path is correct for you wsdl and the ‘include’ statement in the top php script.  Also, check out the reference for the PHP Soap Client.  It’s really easy to use and the documentation and examples are great.



I hope this makes sense and helps you along the way.



Marty



From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, May 30, 2013 12:22 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Michael Schmidt in AXL Developer - Administration XML Questions: PHP SQL Commands



Michael Schmidt has created a new message in the forum "Administration XML Questions": -------------------------------------------------------------- Hi,

I want to build up a personal website maybe via PHP to execute after choosing something in this website some SQL command like

- select
- insert
- update
Is it possible to use these SQL commands direclty from a PHP website or should I open via the PHP homepage some Perl Scripts in which the SQL commands are?

Does anybody have a example PHP code with these mentioned SQL commands?

BR
Michael
--
To respond to this post, please click the following link: http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/15728491 or simply reply to this email.

Subject: RE: PHP SQL Commands
Replied by: Michael Schmidt on 30-05-2013 01:12:13 PM
Hi Marty,
 
thanks I will try this and give you feedback.
 
BR
Michael
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links