Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
Created by: David Carskadon on 03-04-2009 11:42:44 PM Here is a headstart for any of you using php.... I use my own registration site, which is setup (will be setup) to register attendees for WebEx webinars. Code is not fully tested, but a darn good template....
1) file name: xmlParser2
<?php function GetXMLTree ($xmldata) { // we want to know if an error occurs ini_set ('track_errors', '1'); $xmlreaderror = false; $parser = xml_parser_create ('ISO-8859-1'); xml_parser_set_option ($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option ($parser, XML_OPTION_CASE_FOLDING, 0); if (!xml_parse_into_struct ($parser, $xmldata, $vals, $index)) { $xmlreaderror = true; echo "error"; } xml_parser_free ($parser); if (!$xmlreaderror) { $result = array (); $i = 0; if (isset ($vals [$i]['attributes'])) foreach (array_keys ($vals [$i]['attributes']) as $attkey) $attributes [$attkey] = $vals [$i]['attributes'][$attkey]; $result [$vals [$i]['tag']] = array_merge ($attributes, GetChildren ($vals, $i, 'open')); } ini_set ('track_errors', '0'); return $result; } function GetChildren ($vals, &$i, $type) { if ($type == 'complete') { if (isset ($vals [$i]['value'])) return ($vals [$i]['value']); else return ''; } $children = array (); // Contains node data /* Loop through children */ while ($vals [++$i]['type'] != 'close') { $type = $vals [$i]['type']; // first check if we already have one and need to create an array if (isset ($children [$vals [$i]['tag']])) { if (is_array ($children [$vals [$i]['tag']])) { $temp = array_keys ($children [$vals [$i]['tag']]); // there is one of these things already and it is itself an array if (is_string ($temp [0])) { $a = $children [$vals [$i]['tag']]; unset ($children [$vals [$i]['tag']]); $children [$vals [$i]['tag']][0] = $a; } } else { $a = $children [$vals [$i]['tag']]; unset ($children [$vals [$i]['tag']]); $children [$vals [$i]['tag']][0] = $a; } $children [$vals [$i]['tag']][] = GetChildren ($vals, $i, $type); } else $children [$vals [$i]['tag']] = GetChildren ($vals, $i, $type); // I don't think I need attributes but this is how I would do them: if (isset ($vals [$i]['attributes'])) { $attributes = array (); foreach (array_keys ($vals [$i]['attributes']) as $attkey) $attributes [$attkey] = $vals [$i]['attributes'][$attkey]; // now check: do we already have an array or a value? if (isset ($children [$vals [$i]['tag']])) { // case where there is an attribute but no value, a complete with an attribute in other words if ($children [$vals [$i]['tag']] == '') { unset ($children [$vals [$i]['tag']]); $children [$vals [$i]['tag']] = $attributes; } // case where there is an array of identical items with attributes elseif (is_array ($children [$vals [$i]['tag']])) { $index = count ($children [$vals [$i]['tag']]) - 1; // probably also have to check here whether the individual item is also an array or not or what... all a bit messy if ($children [$vals [$i]['tag']][$index] == '') { unset ($children [$vals [$i]['tag']][$index]); $children [$vals [$i]['tag']][$index] = $attributes; } $children [$vals [$i]['tag']][$index] = array_merge ($children [$vals [$i]['tag']][$index], $attributes); } else { $value = $children [$vals [$i]['tag']]; unset ($children [$vals [$i]['tag']]); $children [$vals [$i]['tag']]['value'] = $value; $children [$vals [$i]['tag']] = array_merge ($children [$vals [$i]['tag']], $attributes); } } else $children [$vals [$i]['tag']] = $attributes; } } return $children; }
?> 2) filename: common.php <? require_once('xmlParser2.php'); class xmlCommon {
Subject: RE: PHP wrappers for attendee Registration Replied by: David Carskadon on 06-04-2009 01:44:15 PM An update to function RegisterMeetingAttendee
You can totally skip the 2 call method of 1) createMeetingAttendee then RegisterMeetingAttendee to register someone. The entire registration process can be done with the createMeetingAttendee call... Something I didn't notice last week, this also returns the RegID. The code below has now been updated to return the regID as well. function RegisterMeetingAttendee($MeetingID, $email, $name, $title, $company, $city, $state, $Country) { $xmlCommon = new xmlCommon(); $XML_Header = $xmlCommon->XML_Header(); $XML_Footer = $xmlCommon->XML_Footer(); $URL= $xmlCommon->url; $XML_PORT= $xmlCommon->XML_PORT; $XMLBody.="<bodyContent xsi:type=\"java:com.webex.service.binding.attendee.CreateMeetingAttendee\"> "; $XMLBody.= ""; $XMLBody.= "<name>".$name."</name>"; $XMLBody.= "<title>".$title."</title>"; $XMLBody.= "<company>".$company."</company>"; $XMLBody.= "<address>"; $XMLBody.= "<addressType>PERSONAL</addressType>"; $XMLBody.= "<city>".$city."</city>"; $XMLBody.= "<state>".$state."</state>"; $XMLBody.= "<country>".$Country."</country>"; $XMLBody.= "</address>"; $XMLBody.= "<email>".$email."</email>"; $XMLBody.= "<notes>Registered via API</notes>"; $XMLBody.= "<type>VISITOR</type>"; $XMLBody.= ""; $XMLBody.= "<joinStatus>REGISTER</joinStatus>"; $XMLBody.= "<role>ATTENDEE</role>"; $XMLBody.= "<emailInvitations>false</emailInvitations>"; $XMLBody.= "<sessionKey>".$MeetingID."</sessionKey>"; $XMLBody.="</bodyContent>"; $XML = $XML_Header. $XMLBody. $XML_Footer; $Response = getResponse($XML,$URL,$XML_PORT); $Results = GetXMLTree ($Response); $Success = $Results["serv:message"]["serv:header"]["serv:response"]["serv:result"]; $AttID = $Results["serv:message"]["serv:body"]["serv:bodyContent"]["att:attendeeId"]; $Reason = $Results["serv:message"]["serv:header"]["serv:response"]["serv:reason"]; $RegisterID = $Results["serv:message"]["serv:body"]["serv:bodyContent"]['att:register']["att:registerID"]; if ($Success == 'SUCCESS') $Successful = 1; else $Successful = 0; $answer = array('success' => $Successful, 'attendeeID' => $AttID, 'reason' => $Reason, 'RegisterID' => $RegisterID) ; return $answer; }
Subject: RE: PHP wrappers for attendee Registration Replied by: David Burgess on 21-05-2010 06:15:14 PM i placed the php files on my php server and edited them to reflect my creds for my GDP account, but i have blank pages when i try to browse to them, what step am i missing?
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: