[SOLVED] How to get articles body trought php ?

English! place to talk about development, programming and coding
Post Reply
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

[SOLVED] How to get articles body trought php ?

Post by benoitm »

Hi everyone !

I have a big problem to get article body content with php (trought SOAP module) I prefer to use SOAP module instead of manual query to OTRS Database...

But when i do :

Code: Select all

$article_datas = $this->soapclient->__soapCall("Dispatch", array($this->user, $this->pass, 
				"TicketObject", 	"ArticleGet", 
				"ArticleID",		$article_id, 
			));
:

$article_datas is an array with all data, and hash values... I can't do $article_datas['Body'] to get the body content... why ?

how to do that? (php)

thanks a lot
Last edited by benoitm on 06 Apr 2011, 11:14, edited 1 time in total.
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

Re: How to get articles body trought php ?

Post by benoitm »

I'm here on the official user forum and no answer to this "basic" function ... where to go to have one? please

thanks a lot
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: How to get articles body trought php ?

Post by jojo »

Writing you own client is not a basic function. Please have at the API description (http://dev.otrs.org/)

(Moved Thread to development forum)
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

Re: How to get articles body trought php ?

Post by benoitm »

It's done... thanks
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: How to get articles body trought php ?

Post by Andre Bauer »

Would be nice you would post your solution to help others ;-)
Prod: Ubuntu Server 16.04 / Zammad 1.2

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

OtterHub.org
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

Re: How to get articles body trought php ?

Post by benoitm »

OK yes here is a poart of my solution

It is a function of my homemade class

Code: Select all

// get and return array of on article (SOAP)
	public function get_article_infos($article_id){
		$__article_infos = array();
		try{
			$__article_infos = $this->soapclient->__soapCall("Dispatch", array($this->user, $this->pass, 
				"TicketObject", 	"ArticleGet", 
				"ArticleID",		$article_id, 
			));
			
			// 1 dimension array from 2 dimensions
			$values = array_values($__article_infos);
			$key_start = 0;
			$key_end = count($values)-1;
			for ($key = $key_start; $key < $key_end; $key++) {
				$value = $key + 1;
				$article_infos[$values[$key]] = $values[$value];
				$key++;
			}
			return (array)$article_infos;
		}
		catch(SoapFault $soap_error){
			$this->soap_error = $soap_error;
			echo $soap_error;
		}
	}
With that i can do for exemple : $article_info['Body'] to get the body

I have many functions, one to get all articles information of one ticket, with for and other php code

Contact if you need more information of this
Post Reply