Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- error_reporting(E_ALL);
- # Please define the connection information here:
- $url = "";
- $username = "";
- $password = "";
- $title = "My Test Ticket via SOAP and PHP";
- $from = "me@example.com";
- # Set up a new SOAP connection:
- $client = new SoapClient(null, array('location' =>
- $url,
- 'uri' => "Core",
- 'trace' => 1,
- 'login' => $username,
- 'password' => $password,
- 'style' => SOAP_RPC,
- 'use' => SOAP_ENCODED));
- # Create a new ticket. The function returns the Ticket ID.
- $ticket_parent = $client->__soapCall("Dispatch", array($username, $password,
- "TicketObject", "TicketCreate",
- "Title", "Nouvel arrivant : M.Dupont",
- "Queue", "SI",
- "Lock", "Unlock",
- "PriorityID", 2,
- "State", "new",
- "CustomerUser", $from,
- "OwnerID", 1,
- "UserID", 1,
- ));
- $ticket_enfant1 = $client->__soapCall("Dispatch", array($username, $password,
- "TicketObject", "TicketCreate",
- "Title", "Ouverture du compte de M.Dupont",
- "Queue", "SI::Droits et accès",
- "Lock", "Unlock",
- "PriorityID", 2,
- "State", "new",
- "CustomerUser", $from,
- "OwnerID", 1,
- "UserID", 1,
- ));
- $ticket_enfant2 = $client->__soapCall("Dispatch", array($username, $password,
- "TicketObject", "TicketCreate",
- "Title", "Création du compte blabla de M.Dupont",
- "Queue", "SI::Applications métier",
- "Lock", "Unlock",
- "PriorityID", 2,
- "State", "new",
- "CustomerUser", $from,
- "OwnerID", 1,
- "UserID", 1,
- ));
- # A ticket is not usefull without at least one article. The function
- # returns an Article ID.
- $client->__soapCall("Dispatch",
- array($username, $password,
- "TicketObject", "ArticleCreate",
- "TicketID", $ticket_parent,
- "ArticleType", "webrequest",
- "SenderType", "customer",
- "HistoryType", "WebRequestCustomer",
- "HistoryComment", "created from PHP",
- "From", $from,
- "Subject", $title,
- "ContentType", "text/plain; charset=ISO-8859-1",
- "Body", "Demande de déménagement",
- "UserID", 1,
- "Loop", 0,
- "AutoResponseType", 'auto reply',
- "OrigHeader", array(
- 'From' => $from,
- 'To' => 'SI',
- 'Subject' => $title,
- 'Body' => "ICI LA DEMANDE"
- ),
- ));
- # A ticket is not usefull without at least one article. The function
- # returns an Article ID.
- $client->__soapCall("Dispatch",
- array($username, $password,
- "TicketObject", "ArticleCreate",
- "TicketID", $ticket_enfant1,
- "ArticleType", "webrequest",
- "SenderType", "customer",
- "HistoryType", "WebRequestCustomer",
- "HistoryComment", "created from PHP",
- "From", $from,
- "Subject", $title,
- "ContentType", "text/plain; charset=ISO-8859-1",
- "Body", "Demande de déménagement",
- "UserID", 1,
- "Loop", 0,
- "AutoResponseType", 'auto reply',
- "OrigHeader", array(
- 'From' => $from,
- 'To' => 'SI',
- 'Subject' => $title,
- 'Body' => "ICI LA DEMANDE"
- ),
- ));
- # A ticket is not usefull without at least one article. The function
- # returns an Article ID.
- $client->__soapCall("Dispatch",
- array($username, $password,
- "TicketObject", "ArticleCreate",
- "TicketID", $ticket_enfant2,
- "ArticleType", "webrequest",
- "SenderType", "customer",
- "HistoryType", "WebRequestCustomer",
- "HistoryComment", "created from PHP",
- "From", $from,
- "Subject", $title,
- "ContentType", "text/plain; charset=ISO-8859-1",
- "Body", "Demande de déménagement",
- "UserID", 1,
- "Loop", 0,
- "AutoResponseType", 'auto reply',
- "OrigHeader", array(
- 'From' => $from,
- 'To' => 'SI',
- 'Subject' => $title,
- 'Body' => "ICI LA DEMANDE"
- ),
- ));
- $client->__soapCall("Dispatch",
- array($username, $password, "LinkObject", "LinkAdd",
- "SourceObject", "Ticket",
- "SourceKey", $ticket_parent,
- "TargetObject", "Ticket",
- "TargetKey" , $ticket_enfant1,
- "Type", "ParentChild",
- "Direction", "Target",
- "State" , "Valid",
- "UserID", 1
- ));
- $client->__soapCall("Dispatch",
- array($username, $password, "LinkObject", "LinkAdd",
- "SourceObject", "Ticket",
- "SourceKey", $ticket_parent,
- "TargetObject", "Ticket",
- "TargetKey" , $ticket_enfant2,
- "Type", "ParentChild",
- "Direction", "Target",
- "State" , "Valid",
- "UserID", 1
- ));
- # Print the info to the screen.
- echo "You have just created ticket id $ticket_parent.\n";
- ?>
Add Comment
Please, Sign In to add comment