Community Forum

Please read the intro before joining/posting. Thank you.

If you have questions about our software, chances are this forum has the answers.

You'll need to register before you can post on the forum to ask your question or to answer another one. A reply will be posted to each and every question that is asked so there is no need to double post or bump your post. We'll do our best to answer promptly, but in some cases it may take a day or two. If you bump your post, it may be removed. Bear with us and we'll get your question answered quickly.

Here are a few tips to help you to get your questions answered more rapidly.

IMPORTANT: Posts in English only. We don't employ translators and we'll be unable to understand your message properly and will probably delete it.
SOFTWARE: Each software has it's own forum. Software here is NOT supported. Posts about this software will be deleted. Supported software questions ONLY please.
SEARCH: Use the search option to see if your question has been answered on the forum before now or if there is an answer in the documentation of your software.
PERSONAL SUPPORT: If you have purchased a commercial version of any software, using the contact option at the licence centre ensures a faster response.
AUTO DELETION: Accounts older than 5 days, with no posts or topics, are automatically deleted. Only register if you are thinking of posting.
LINKS: Any links posted are not clickable (to deter spammers) and must be copied / pasted into your browser address bar.

            

You are not logged in.

Search Results
angphc @ 05-06-2020 19:11:56

Hello David I have just reviewed 4.3
These are some of my findings:

Minor Bugs/annoyances and a feature request
------------------

Settings/General
Timezone Caracas still appears as GMT - 4:30 and has changed to GMT -4:00 since 2016
(perhaps this is PHP's  timezone database related), nothing to die for, user just need to change it to AMERICA/LA PAZ and it's done, (can't use America/NYC because in this country there's not DST)

------------------------------

Settings/attachments
if the server path to attachments is supposed to be
/var/www/content/attachments

when the button to auto-update the folder is pressed it appears like this:
/var/www/content/FOLDER_NAME_HERE

Somehow triggers the string $msg_settings128 frrom  lang4.php  (line 486 in my current install)
and uses it as an actual path instead of the path that's supposed to be there.
Don't know what's the actual usage of that
-----------------------
Admin Pages/Manage

I still don't read the documentation about Admin pages and don't know what they are for. I promise I will read them soon

but if you try to create an Admin page using custom admin_test_page.php template
you will receive a popup saying "Please enter page title" even when the name has bin written in the field.

---------------------------------
When updating profile
(Tested on admin user only)
The popup options are very confiusing

If it is a notification then In my opinion its desirable to remain as an informative only popup with a large and clear OK ACK button.
Instead of edit, manage, add  options that are provided
that doesn't make a lot of sense until you click on the 3 of them and you can see what them are doing.

If those options are to remain there at least, first Place an OK/Close button and not rely in the closing X at the corner of the notification window.
and then have more verbosity about those options,
something like this

+---------------------------+
|      SYSTEM MESSAGE       |
|                           |
| The user has been updated |
|                           |
|         +------+          |
|         |  OK  |          |
|         +------+          |
| ------------------------- |
| You can also:             |
| Keep editing this user... |
| Manage another users...   |
| Add a new user....        |
+---------------------------+

It's just a matter of adding more context to those options. and making easier to close the window.
.-------------------------------------------

The Feature Request(s)

It would be great if

licence.lic

and

control/connect.php

are included in the zip installer as

licence.lic.dist

and

control/connect.php.dist

and in the install instructions, well, instruct the user to rename them to licence.lic and control/connect.php during first install.

Yes I know the readme clearly states that these 2 files must be removed from installer package when updating but it's easy to forget, specially when an update goes wrong and you repeat the process a few times.

This leads to another feature request

Distribute the maian-latest.zip withouth the parent maian-support/helpdesk folders, because of the still unresolved in this 21st century inhability of mv command to merge folders easily.
At least distribute as a tar where is possilble to strip parent folders on extraction time.
Fortunately I have several backups of my project, but it still a mild torture copying back and forth both files from the backups each time.
It will make updates even easier and will just add a couple of steps in the first install
---------------------

OTOH I updated spanish translation files for spanish 4.3 but the contact form in maianscriptworld is not working. Gonna send them straight to your email after some testing.

Go to topic
Go to post
angphc @ 16-03-2016 14:50:37

Well i have never used attachments, but I only use a custom php-form and invoke the ticket creation via API. So a different scenario here

Go to topic
Go to post
angphc @ 15-03-2016 21:57:44

That is a message that your ticket was created successfully.
did you use a custom form to generate the ticket via API
Did you use the code example in the forum?

Go to topic
Go to post
angphc @ 15-03-2016 17:07:07

ioncube was part of the prior licensing/code protection system.
From 3.x is no longer used. I think you need to contact David so he can help you with your license.
Try going to the license center

Go to topic
Go to post
angphc @ 15-03-2016 16:14:03

Ioncube was deprecated from 3.x
l

Go to topic
Go to post
angphc @ 15-03-2016 14:53:32

Is the ticket created using the API?

Go to topic
Go to post
angphc @ 08-03-2016 20:01:20

Well I have never had this problem before, but usually this kind of error happens when you use some function that returns an stdClass object.
The most typical is for example if you're using
$some_data is an array
$some_data= json_decode($yourvariable)// in this way json-decode translates decodes json object to an stdClass object

the correct syntax should be to
$some_data=json_decode($yourvariable,TRUE) // the second parameter translates decoded json object into a valid php array

If you're using the API or interacting with maiansupport in some automated way. This might be a cause.
If not we should better wait for David to tell us what might be happening.

Go to topic
Go to post
angphc @ 06-02-2016 21:17:27

I checked the code.
Note: You still need to allow the file extension in your allowable file types.
You must put the extension including the dot and separate it with | pipe symbol

example:

.jpg|.zip|.gif|.rar|.png|.pdf|.txt

Continuing with your issue...

If you read the api-debug log you will notice that the api detected two attachments, but with invalid size and advices you that perhaps is a permissions problem.

but it says TWO attachments and you only have one!!!!!!
you need to change your ATTACHMENTS section in your ticket array
from this

"attachments"	=> array(
					"file" => array
							(
								"ext" => $params['file']['ext'],
								"data" => $params['file']['data']
												  
							)
								  
				   )
			

to this

"attachments"	=> array(
					"file" => array
							(	
								array
									(
										"ext" => $params['file']['ext'],
										"data" => $params['file']['data']
												  
									)
							)
						)

Please notice that the attachments array contains a file array. But this is not actually  a file array, but a FILES (in plural) array.
So is a 2-dimensional array where the first dimension is (i assume) an internal index created by Maiansupport and the second dimension is the array that contains your attachment data and extension. (Arrayception someone? cool )

I have never used API to send attachments so It took my a while to figure it out (had to reencode api json data example to analyze it in a php manner: JSON is not so human-readable for me yet hmm)
By the way I recommend you this magnificent online tool to validate, beautify, minify, and display in a tree-manner your JSON data
http://codebeautify.org/jsonviewer

I'm gonna update the API tutorial to handle your case

NOTICE to lemursky
If it solves your problem I  kindly ask you to update your post title and add [SOLVED]
Also when you need help with code. Please be kind to place it here between code tags

[­code]
Your code here
[­/code]

Real code is easier to copy, analyze and debug than an screenshot.


Note to David
I noticed that attachments create a folder with the year, another inside with the month, and attachments are created inside of it.
What itches me a bit yikes is that the folders are created with 777 permissions and attachments with a more correct 644 permissions
I know that sometimes a missconfigured web server might require 777 permissions for this kind of tasks,

IMHO it could be great if there was an option to choose the file permissions for this folders and every user determine what works better for him/her.

Usually a well configured web server will run apache and php as the correct user and 022 umask is more than enough.

Go to topic
Go to post
angphc @ 06-02-2016 14:43:44

It seems that you have not allowed any file extensions in your attachments settings.
Have you tried putting txt in your allowab file extensions?
Please let us know.
I currently not have any Maiansupport script installed by now but as soon as I can gonna give a try to your code

Go to topic
Go to post
angphc @ 03-12-2015 19:30:39

Well something you can use your  hostings forward capabilities so all email from each member email address gets redirected to your departments main address

Go to topic
Go to post
angphc @ 01-12-2015 22:37:36

Well usually the work just right out of the box
Email notification when account/ticket is created/changed/deleted
If this is a new Install please verify
http://www.maiansoftware.com/demos/msupport/docs/install_2.html

Specially step #7 since every email operation relies in SMTP settings correctly configured

Please let us know if you still can't receive notifications after configuring SMTP settings.
Also take a look to /logs/mail_debug_log.txt

Go to topic
Go to post
angphc @ 27-11-2015 15:01:28

If you are working in a localized versions of Maiansupport and/or have viewed, edited, or opened your files with Microsoft Windows
There might be an encoding error in some of the files.
1)Verify all your lang files are UT8 without BOM encoded
2)Check if someone opened or modified some of the files (running some diff file against the original pack -tool might help) If some of the files was modified check and recheck files encoding
3)Is this an update  from 3.0 to 3.1?
4) File permissions (check your apache logs sanitize them and post here inside  [ code ] [ /code ]   tags)

Please report any further findings you make (even if you solved it, please be kind to show how you solved it)

Go to topic
Go to post
angphc @ 27-11-2015 14:05:34

If you have moved your Maian Support to a new server, file, folder, subfolder there might be some routes pointing to your old location.
Please be kind to post your error logs. So david or other people in the forum can help you better (also helps other users to remedy a similar situation in the forum)
Also use developer tools or firebug and check the errors section in the console.
If you're using a non-english language as a default please read this post.
http://www.maianscriptworld.co.uk/forums/viewtopic.php?id=3542

Go to topic
Go to post
angphc @ 26-11-2015 23:42:34

BEWARE, WARNING, ACHTUNG!, ALERTA! CUIDADO!
FOR ALL PEOPLE USING NON-ENGLISH LANGUAGE IN MAIANSUPPORT
When you use localized version two conditions must be met.

1) All lang. files must be UTF-8 without BOM encoded ALWAYS. Failure to do so might give problems like: ajax-icon spinning forever, some functions not working, database corruption, your dog eating your homework.

2) In version 3.1 there's a new lang file. It will probably not be present (neither translated nor untranslated in your language folder and the backend (or the whole app) will fail: Simply copy the missing file from your the english folder to your language folder. Part of you support desktop will be still in english but at least will be working
(For spanish users I'm already translating it as soon as it's ready I'll send it to David so it is included in the bundle)

Go to topic
Go to post
angphc @ 26-11-2015 23:24:05

question wrote:
Hi David,
first I want to thank you for your help. I try to use now sometimes {id}.
At the moment i have an other problem: my helpdesk isn't sending mails. First I think, I've make a mistake while translating to german, but after changing language back to english I have to notice the error diddn't gone.
If I create a new ticket or assign one I get three or five same error-massages:

ERROR:
[Error Code: 2] preg_match(): Compilation failed: internal error: previously-checked referenced subpattern not found at offset 728
[Date/Time: 2 June 2015 @ 15:18PM]
[Error on line 886 in file /var/www/helpdesk/control/classes/mailer/class.phpmailer.php]
- - - - - - - - - - - - - - - - - - -

STANDARD CODE:
...
                return (bool)preg_match(
                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
                    '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
                    $address
                );
...

I don't change anything in this file. My php-knowlage is very low, so I only can surmise the lines of the file are needet to check up the mailadress? I'm testing the system now for exactly 2 weeks. Is there a counter blocking something?

Maybe you could help me again. Thanks for it.

Go to topic
Go to post
angphc @ 02-04-2015 07:30:41

Hello I would like to know if is possible (Or how hard would be to create a function) to export a ticket.

Maybe I'm missing something but the only option I've found about exporting is ticket's Timeline but no real data from inside the ticket.

I live in a country with very restrictive access to foreign currency so the most important payment gateways simply do not work here.
There's a company that developed a payment gateway that works with our domestic credit cards. Their API requests a simple array in this form:

$post_values = array(
"nbproveedor" => "API LOGIN ID",
"nb" => "stephen",
"ap" => "king",
"ci" => "99888123",
"em" => "stephen@thelangoliers.com",
"cs" => "API Transaction key",
"nai" => "12333",
"co" => "Purchase in your commerce",
"tl" => "02127400012",
"mt" => "23.50");

That will prepopulate a payment button.

Let's assume many of this data are already on the ticket as Custom Fields.
Is it possible to export them as CSV ?

I've read that for advanced users is possible to parse own php code is there a guideline or documentation about how to do it?
There's also a file named defined.inc.php what is its function? Does it allow to write some kind of new sections in the admin area like plugins?

May any of the above options work to what I'm trying?

Go to topic
Go to post
angphc @ 28-03-2015 19:25:40
Background:

[UPDATE]
Now API Examples includes attachments example
NOTICE: WHEN USING ATTACHMENTS via API you may need to change your php settings to higher execution times


I think API is one of the most underrated and most useful features of the system.
Even when documentation is clear and simple on how to use this awesome feature I want to help another people to make it easier to make use of it. Since it seems that many people doesn't use it. (In the whole forum is mentioned only once)

JSON and CURL php extensions are recquired for this mini-how-to

We're taking advantage of php JSON extension to easily create JSON strings from arrays.

Each level in the array will create a JSON object within the JSON object that API will be able to understand

If the email is not registered in Maian Support it'll create a new account before creating the ticket.



Let's go straight to the stuff

[list=1]
[*]Copy and paste the code in the bottom of this post to a new php file[/*]
[*]Modify what is recquired in the code's comments [/*]
[*]Place this php file in your web server and open it in your browser[/*]
[*]Log in to your Maian Support control panel. Now you should be able to see a new Ticket Created[/*]
[*]Replace the hardcoded values in the array with your $_POST  data references[/*]
[*]Make your web form to send values to this file via  POST[/*]
[*]Enjoy![/*]
[/list]

Tips and tricks:

[list=*]
[*]Validate all your data in your form managing before submitting it to MaianSupport API. It would be easier to troubleshoot later and you may not even need to add code to manage errors here.[/*]
[*]While developing and testing your API interactions enable (and clear often) internal log files (you may not even need to look to your server's logs[/*]
[*]Make liberal use of break points and comments all around your code while debugging (I personally prefer ye olde var_dump and die() functions)[/*]
[*]Notice that if you want some formatted text in your tickets (In coments section obviously) You may send data already formatted using BBcode. To know which BBcode tags are available read Maian Support documentation.[/*]
[*]DO NOT use html tags in your comments section. HTML will not be parsed. HTML tags will be shown literally[/*]
[*]Make sure all your files are encoded using UTF-8 without BOM if not some weird errors may appear that are very difficult to track down[/*]
[*]If you're using your own method to generate JSON data  you can have a great help to troubleshoot your data structure with this awesome tool http://codebeautify.org/jsonviewer . It doesn't only beautify your json data to make it more human readable. It can also help you to validate it[/*]
[/list]



<?php
/*********************************************
 Create new ticket and account if does not exist using API and JSON
  ASSUMPTIONS FOR THIS TUTORIAL
		 1.-Let's assume your Maian Support is installed  in www.yourdomain.com/helpdesk. Change this script accordingly
		 2.- You have a Department which ID is 01. **READ API DOCUMENTATION ABOUT WHAT DATA YOU MUST PUT IN THERE**
		 3.- Your server supports CURL
		 4.- You have generated a valid API key in Maian Support settings
		 5.- You have enabled API access on your Maian Support Control Panel
		 6.- You are going to put a valid email address in EMAIL field below so you can check the functionality

 **********************************************/

#replace www.yourdomain.com with your real domain.
$url="http://www.yourdomain.com/helpdesk/index.php?api=yes";

#Replace your_api_key with your real API. Check your api settings
$api_key="your_api_key"; 


#Setup the values that the ticket will receive
	##example data assuming your Form is instructed to POST results to this file.
		/*
		$Incoming_Data = $_POST
			$params['name']		=	$Incoming_Data['$YOUR_FORM_NAME_FIELD_VALUE'];
			$params['email']	=	$Incoming_Data['$YOUR_FORM_EMAIL_FIELD_VALUE'];
			$params['dept']		=	$Incoming_Data['$YOUR_FORM_DEPT_FIELD_VALUE']; //THIS CAN BE HARDCODED BUT MUST BE A VALID VALUE FOR THE API
			$params['subject']	=	$Incoming_Data['$YOUR_FORM_SUBJECT_FIELD_VALUE'];//THIS CAN BE HARDCODED BUT MUST BE A VALID VALUE FOR THE API
			$params['comments']	=	$Incoming_Data['$YOUR_FORM_COMMENTS_FIELD_VALUE'];
			$params['priority']	=	$Incoming_Data['$YOUR_FORM_PRIORITY_FIELD_VALUE'];//THIS CAN BE HARDCODED BUT MUST BE A VALID VALUE FOR THE API
			$params['Cust_Field1'] =	$Incoming_Data['$YOUR_FORM_**_FIELD_VALUE'];//NOT MANDATORY CAN BE EMPTY OR NOT DECLARED AND TICKET WILL BE CREATED
			$params['Cust_Field2']	=	$Incoming_Data['$YOUR_FORM_**_FIELD_VALUE'];//NOT MANDATORY CAN BE EMPTY OR NOT DECLARED AND TICKET WILL BE CREATED
			$params['attachment1']	=	$Incoming_Data['$YOUR_FORM_ATTACHMENT1']; // NOT MANDATORY, MUST BE BASE-64 ENCODED
			$params['attachment2']	=	$Incoming_Data['$YOUR_FORM_ATTACHMENT2']; // NOT MANDATORY, MUST BE BASE-64 ENCODED
		*/

	##	Hard Coded Values For instructive purposes.
			# Mandatory fields
			$params['name']			= 	'Joe Bloggs';
			$params['email']		=	'guest@somesite.com';//CHANGE FOR A VALID *REAL* EMAIL ADDRESS
			$params['dept']			=	'01'; //MUST BE A VALID DEPARTMENT ID FOR YOUR MAIAN SUPPORT INSTALLATION
			$params['subject']		=	'Hello; can you help please?';
			$params['comments']		=	'Lorem ipsum dolor sit amet consectetuer tristique leo lacinia orci lorem. Id tempor vitae et congue Nulla vitae gravida ac ipsum odio. Laoreet a euismod et Nunc laoreet Lorem et pellentesque cursus augue. Nec ipsum leo facilisis Morbi wisi Cras dictumst quis diam Cum. Porta Nam Nunc fames nunc sed.';
			$params['priority']		=	'high';//MUST BE A VALID PRIORITY ID FOR YOUR MAIAN SUPPORT INSTALLATION

			# Optional Fields
			$params['Cust_Field1']	=   'Custom field ID 1 data';
			$params['Cust_Field2']	=   'Custom field ID 2 data';

			#Attachments
			$params['file1']['data'] = base64_encode("This file is an uploaded attachment using the Maian Support API");
			$params['file1']['ext'] = "txt";

			$params['file2']['data'] ="iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAABh0RVh0VGl0bGUATWFkZSB3aXRoIFNvZGlwb2Rpn/QvJwAAAA50RVh0QXV0aG9yAFVua25vd26MIQzyAAAAHnpUWHREZXNjcmlwdGlvbgAAeJxLVCjITC4pLUoFABBfA37q9A0sAAAF/0lEQVR4nL2XfUxcVRrGf+fM3I+ZdrAFBspXWkr6sXy0FEWqXWS3IaS60ZQujQtRNC0a/tFkU2vUxETXGLNm181mm6hpYja6a41LLaFrIWqNxTbZxQ6psSuN1ZYWgVQKTGGAmTt37tk/KiAwg8O27pOc5N57nvO+z3nve9/zXsHSoAO/AEqALJeLXMchohQDwCDwb6ALUMkaFElwJLDbMMRvYjF2CIG2dq0RXb3akKtXG3ok4qje3ojV12ep3t6IoesiaNvqSCzG34GPb1TAr3Rd/FEIChob/fK++1bK7dtT8HpdcckjIzYdHUFaWoajra2jbrdbnIhG1T6ge6kCpKaJ3zuO+m1zcybPPpvjyszUf2wzc3Du3BRPP33ZOnp0VMRi7AXeSlbACtMUh1NSXD9vb/+ZXla2bEmO5+Pw4WEaGr62leJP0ah6CnAWE+AxDNFVWOhZf+zYRn3VqqXtOhE++yxETU2PFQo5B2xb7UsowO0Wh7KytNozZzYZqanum+J8GqdPh9i27T+2ZalHgL9OP5c/4DS43fy6o2PjAue2rQiH50RuybjttuW88846t8vFQaB4vgDDNMUfXnwxTyss9M5Z2N09QXZ2AL//NEeOjCzq5KWX+vH7T/Pgg19j2wtLQW1tKvffn4Zpij/Pn9uXmamFw+HblVJb54yHHkpXXC8sqrx82YL56XH16q1KSma4HR0b4/IuXixVLhcxYPtMBExTPPn887mGYcj5wmhvD85cBwITjI/H4u7++PExnB+8paNHR+Py1qwxaWrKwDTFk9MCSiMR5a+tTY27oKRk9pVkZ+v4fPGLUHa2Nuc+Ly/xF1RXlyajUfVLwCOBe0tLvVZGhhaX3Njon7mur09LaPSOO3xkZl634XZDXV1i7l13+dB1IYFqt2mK6urqW4xE5MZGPxkZGqFQjF274kcJwOUSdHYW8vbbV6mqSqGgwEzI1XVJRYXP+eSTsUq3ECI3Ly+hfwB27Fix6Pw01q/38NxzeUlx8/MNvbOTXGnbKiMnJ374f0rk5uoYhlwjYzFleDwLs/+nhscjEQKv1HUxPDgY/b8LGBy0iEZVn5RSDPT3WwBcuWJRU9ODZd1Y2U2EQ4eu8u23EQAuX7bsaFT1Sctyzn7++WQMIDXVTSAQ4v33g4sa+l9g24q9e78hEJgA4MyZCRs4J22bI+3tQScaddA0ye7dabz55tBNF3D27CRTU4o77/Rx/vwUly5ZJtAmgQ8iEUd1do4D0NCQzrFjQYaHb25evP76FaqqfPj9Gm1to3i98iugVwKTmiZaX355IApQWekjP9/g4Ye/wXGSbm4XxalT47zxxhDPPJODZTm88spgZHLSOQjfH0bhsHrqo4+uyRMnxhBC0Nq6gU8/HWf//ss37LyrK8Q995yjuTmTmpoVvPrqFYaH7WvAAYDpkyWo6yK9q2uibM8ev2vVKp0tW5bx+OO9LF8u2bp1OUIk08HPRSAQoqamh/r6NA4cyGdgwKKu7rw1Oek8BgTm81MNQww0Nqbb02f3a6/lK00TqrLSp774YlPCXmD+uHRpi2puzlC6LlRTk185ToWamChXxcWesGmKf7LI78Bml4vICy/kzhjr6dmsqqtTlNuNeuKJLHXhQmlcp2Nj5erkyaIZx5s2edV7761XjlOhwuHb1d13r7A8HtkD/GibvUPTxMSePX7bsmY7pJaWdaqgwFCA2rDBVDt3rlSPPpqhdu1KVQUFhhLieidUUuJR7767TjlOhVJqqxoaulWVly+LmKa4CCw4qRKFYoPXKz8oKvJkHTy4Vtu8eVZ0d/cEH34YpL/fYmjIJi3NTXGxl+JiD0VFXlaunG1oOzqCNDVdiIyM2P+amnJ2AkuqcLeYpviblMQeeCDd/vLL5HLAcSrUyZNFqqrKF3G5sKTkd8wm+wIkk9qlHo/8y9SUsy03V7dqa1ONsjIvOTk6OTk6lqXo77fo77c4dWrcaWsbta9di7l1XfwjElH7gb6l7Hox5ADNHo88bhjiOyGw+b4DdrmImKYYMAzRAtQDyXUwwH8BhdfXW8MDregAAAAASUVORK5CYII=";
			$params['file2']['ext']= "png";


#Let's Prepare the data for JSON encoding.
#Each level on the array will generate a json object within the json object
#READ API USAGE DOCUMENTATION to understand this.
#*DO NOT CHANGE ANYTHING IN ARRAY KEYS* (EVERYTHING BEFORE THE => )
#Array keys are case sensitive for the API to parse the ticket correctly 
#*DO NOT CHANGE* case in api keys.

#**********************DO NOT MODIFY ANYTHING BELOW UNTIL  NEW NOTICE ****************************
$ticket_array= array 
(
		"api"	=>	$api_key,
		"op"	=>  "ticket",
		"tickets"=>	array
		(
			"ticket" => array
			(	
				"name"			=>	$params['name'],
				"email"			=>	$params['email'],
				"dept"			=>	$params['dept'],
				"subject"		=>	$params['subject'],
				"comments"		=>	$params['comments'],
				"priority"		=>	$params['priority'],
				"customfields"	=>	array 
									(
										"f1"	=>	 $params['Cust_Field1'],
										"f2"	=>	 $params['Cust_Field2']
									),
				"attachments"	=> array
									(
										"file" => array
										(	
											array
											(
												"ext" => $params['file1']['ext'],
												"data" => $params['file1']['data']
											),
											array
											(
												"ext" => $params['file2']['ext'],
												"data" => $params['file2']['data']
											)
										)
									)
		

			)
		)
	);


#pre-checks. CURLS and JSON extensions which are recquired for this example to work
function_exists('curl_version') or die('CURL support required');
function_exists('json_encode') or die('JSON support required');

#Very important to json_encode the array
#since Maian Support API receives only JSON or XML
#In this tutorial we're using JSON 	
$ticket_string=json_encode($ticket_array);	

#set timeout
set_time_limit(30);

#CURL's Magic
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $ticket_string);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$res = json_decode($result,true);

#**********************THE FOLLOWING CODE MUST BE MODIFIED TO PROCESS ERRORS ACCORDINGLY  ****************************


#Manage the results from here
/*some code to manage 
your results */



/* DEBUG ONLY REMOVE FOR PRODUCTION */
echo "This is the result of API call \n<pre>";
print_r($res);
echo "</pre>\n\n";
echo "If there was an error check your API debug log. Stablish actions according to results"; 

/**/
#We're done, verify your control panel and you will see a new ticket created via API

?>
Go to topic
Go to post

 

100% Free SoftwareSoftware Versions, Development, Docs & UpgradesHostingNewsletter
Made with in the U.K & Hong Kong

Free PHP Scripts / Responsive PHP Scripts / Lightweight PHP Scripts / White Label PHP Scripts