Question:
Does anyone have an example of a PHP cURL PUT method for Web Help Desk? !
Trying to accomplish:
I am trying to link a chromebook(asset) with a student(client) using the PUT method.
I would also like to link a ticket to an asset.
Other thoughts:
How do I "PUT"? Do I create and array with my modifications, then to call an "array to JSON" function? If so how do I post the data to this kind of URL? "https://hd.northcantonschools.org/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/ticket#/?username='. $username . '&password='. $password . '&limit=1000"
Relevant links:
From solarwinds: Web Help Desk REST API Guide
Using these videos I was able to create the code below:
PHP cURL Tutorial Part 1: Basic Structure - YouTube
PHP cURL Tutorial Part 2: Download Files Using cURL (Cont'd) - YouTube
PHP cURL Tutorial Part 3: Posting Data To The Server - YouTube
PHP cURL Tutorial #4: Post Files To Server Using CURLFile Class - YouTube
Tried:
GET and it works
<?php //PHP cURL GET list of my tickets in JSON //includes---------------- //NCCS emg login require('include/hd_login.php'); //$username and $password //includes---------------- //Variables--------------- $ch = ""; //curl session id/handler $curl_data = ""; //curl return text //Variables--------------- //initilize session $ch = curl_init(); //set soptions curl_setopt($ch,CURLOPT_URL, 'https://whd.northcantonschools.org/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/mine/?username='. $username . '&password='. $password . '&limit=1000'); curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, false); //ignore invalid certificate (this should be fixed for security reasons, once a server is permanently setup for this site) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //execurte session $curl_data = curl_exec($ch); //close session curl_close($ch); //print results echo $curl_data; ?>