cricket ticket using php script....

English! place to talk about development, programming and coding
Post Reply
lingaprashanth
Znuny newbie
Posts: 3
Joined: 07 May 2010, 08:49
Znuny Version: 2.4

cricket ticket using php script....

Post by lingaprashanth »

Hi All,

I am trying to build customer interface for otrs using php. I am trying to connect to otrs using php. i tried the code from http://lists.otrs.org/pipermail/otrs/20 ... 28525.html

i hav changed user id and password according to otrs installation. presently iam using ubuntu 9.10.

<?php
ini_set('display_errors', 'On');
$otrs_subject = "test";
$otrs_queue = "raw";
$otrs_from = "lingaprashanth@cogitate-it.com";
$otrs_email = "otrs@localhost";
$otrs_user = "lingaprashanth";
$otrs_pass = "cogitate";
$otrs_url = "http://localhost/otrs/rpc.pl";;
$otrs_queue = "Raw";

$otrs_customerid = $otrs_from;
$otrs_customeruser = $otrs_from;
$otrs_userid = 2; # your OTRS-Userid, varies of course in every installation
$otrs_message = "Test";

$soapclient = new SoapClient(null, array('location' =>
$otrs_url,
'uri' => "Core",
'trace' => 1,
'login' => $otrs_user,
'password' => $otrs_pass,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED));

# creating a ticket number
/* $ticketnr = $soapclient->__soapCall("Dispatch",
array($otrs_user, $otrs_pass, "TicketObject", "TicketCreateNumber")); */

$ticketnr = $soapclient->__soapCall("Dispatch",array($otrs_user,$otrs_pass, "TicketObject", "TicketCreateNumber"));

#php changes long numbers to 123E+10 notation to prevent this screwing up our ticketnumbers we convert notation
#it into normal plain numbers. but only if not string, because sometimes you have a string addition like XY123 on your
#ticket numbers
if(! is_string($ticketnr) ) $ticketnr =
number_format($ticketnr,0,
'.', '');

// # create the new ticket


$ticketid = $soapclient->__soapCall("Dispatch",
array($otrs_user,
$otrs_pass, "TicketObject", "TicketCreate",

"TN", $ticketnr,

"Title", $otrs_title,

"Queue", $otrs_queue,

"Lock" , "unlock",

"PriorityID", 3,

"State" , "new",

"CustomerId", $otrs_customerid,

"CustomerUser", $otrs_userid,

"OwnerID" , $otrs_userid,

"UserID", $otrs_userid

));

$articleid = $soapclient->__soapCall("Dispatch",
array($otrs_user,
$otrs_pass, "TicketObject", "ArticleSend",
"TicketID" ,
$ticketid,
"ArticleType" ,
"email-external", # email-external|email-internal|phone|fax|...
"SenderType" , "agent", # agent|system|customer
"From" , $otrs_from,
"To" ,
$otrs_email,
"Subject" ,
"[Ticket#".$ticketnr."] ".$otrs_subject,
"Body" ,
$otrs_message,
"ContentType" ,
"text/plain; charset=utf-8",
"Charset" , "utf-8",
"HistoryType" ,
"EmailCustomer", # EmailCustomer|Move| AddNote|PriorityUpdate|WebRequestCustomer|...
"HistoryComment" , "generated
by OTRSInterface-Class",
"UserID" ,
$otrs_userid,
"NoAgentNotify" , 0, # if you dont want to send agent notifications
"Type" ,
"text/plain",
"Loop" , 0 # auto reject|auto follow up|auto follow up|auto remove
));



?>


but iam getting an error " Fatal error: Uncaught SoapFault exception: [soap:Client] Application failed during request deserialization: no element found at line 1, column 0, byte -1 at /usr/lib/perl5/XML/Parser.pm line 187 in /var/www/lp/soap2.php:30 Stack trace: #0 /var/www/lp/soap2.php(30): SoapClient->__soapCall('Dispatch', Array) #1 {main} thrown in /var/www/lp/soap2.php on line 30"

if any one hav tried this can me help me out to get rid of the error and continue further.......

thanks in advance...
Andre Bauer
Znuny guru
Posts: 2189
Joined: 08 Dec 2005, 17:01
Znuny Version: 5.0.x
Real Name: André Bauer
Company: Magix Software GmbH
Location: Dresden
Contact:

Re: cricket ticket using php script....

Post by Andre Bauer »

Prod: Ubuntu Server 16.04 / Zammad 1.2

DO NOT PM ME WITH OTRS RELATED QUESTIONS! ASK IN THE FORUMS!

OtterHub.org
andreakappa
Znuny newbie
Posts: 1
Joined: 02 Sep 2010, 11:31
Znuny Version: 2.4

Re: cricket ticket using php script....

Post by andreakappa »

I've checked such link, but as far as I can see it simply does not provide any solution.

But more than that, I'm getting same error on every test I'm doing on my develop server with any "hello world"
soap service; so I think that this problem is not strictly OTRS related but it's due to a more generic Perl SOAP configuration.
The problem is that I'm not finding any solution over the web, neither anything in the server that can help me
in solving it.. just an error 500 in apache access.log. (note that on same apache server i'm correctly serving many
PHP soap services)

Any idea? I can't believe nobody is not getting perl soap working.

Finally, since the thread topic is "Ticket using php script" is there somebody that has a script which
locally creates the ticket (php or perl) without needing an email flow?

Thank you in advance
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: cricket ticket using php script....

Post by crythias »

OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
pam009
Znuny newbie
Posts: 1
Joined: 04 Aug 2011, 10:56
Znuny Version: 11.1
Real Name: Pamela Lucas

Re: cricket ticket using php script....

Post by pam009 »

It doesn't help JMK Design as well :(
Last edited by pam009 on 24 May 2013, 09:34, edited 2 times in total.
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: cricket ticket using php script....

Post by renee »

@pam009: Please provide some information what you have done so far. What do you want to achieve? Are there any error messages? ...
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
Post Reply