letsgaq.blogg.se

How to pass value from one page to another in php maker
How to pass value from one page to another in php maker









how to pass value from one page to another in php maker

$method: HTTP method: "GET", "POST", "PUT" or "DELETE" *Function to call a ProcessMaker REST endpoint and return the HTTP status code and

how to pass value from one page to another in php maker

$pmServer = "" //set to address of the ProcessMaker server Then, it returns an object containing the HTTP status code and the response object. If an error occurs, it will print the error. This function will set the headers depending on the HTTP method and execute the request using cURL. The best way to avoid code duplication is to create a generic function that can handle ProcessMaker REST requests. Print "Error: HTTP status code: $statusCode \n" Ĭurl_close ( $ch ) PHP pmRestRequest() Function If ( isset ( $aUsers ) and isset ( $aUsers -> error ) ) $statusCode = curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) $aUsers = json_decode ( curl_exec ( $ch ) ) $accessToken ) ) Ĭurl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true ) "/api/1.0/workflow/users" ) Ĭurl_setopt ( $ch, CURLOPT_HTTPHEADER, array ( "Authorization: Bearer ". $accessToken = isset ( $_COOKIE ) ? $_COOKIE : getAccessToken ( ) $pmServer = "" //set to your ProcessMaker address It is recommended to check whether the JSON object exists before calling the JSON.parse() method: For older browsers, eval() needs to be used, although it is not as safe.

how to pass value from one page to another in php maker

In JavaScript, the JSON.parse() function can be used to decode JSON strings if using a recent web browser that supports JSON (Internet Explorer 8+, Firefox 3.1+, Chrome 3+, Safari 4.0.3+ and Opera 10.5+). In PHP, the response value can be decoded using json_decode(). ProcessMaker REST endpoints have response values that will return JSON (JavaScript Object Notation) strings, which need to be decoded. It is a good idea to always check whether a REST request was successful after executing it. When a REST request is successful, it will set the HTTP status code to 200 (OK) or 201 (Created). Using this function will simplify your code and help avoid duplication and errors. This page explains how to call REST endpoints using PHP, standard JavaScript and JQuery (which is a library of JavaScript).īecause there is a lot of code involved in sending out each HTTP request and processing the response, it is recommended to create a custom function named pmRestRequest() that will handle the REST requests. Once an access token is obtained from OAuth2.0, the ProcessMaker REST endpoints can be called using that access token. Javascript Calling REST Endpoints Best Practices.Executing pmRestRequest() Synchronously.Executing pmRestRequest() Asynchronously.PHP Calling REST Endpoints Best Practices.











How to pass value from one page to another in php maker