RESTp - Input Formats RESTp supports json, application/x-www-form-urlencoded as MIME type

You can set the format of data to be send as input. Currently it supports, json and application/x-www-form-urlencoded. By default, it is "application/x-www-form-urlencoded" for input data.

  
                                //init curl
                                $ch = curl_init();
                                // URL to be called i.e. end point to access resource. 
                                // e.g. Get all records of a database table name "orders".
                                curl_setopt($ch, CURLOPT_URL, "http://pdocrud.com/RESTP/api/orders/");
                                //set http headers for input
                                // input as json
                                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
                                // input as text/html
                                //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: text/html'));
                                // input as xml
                                //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml'));
                                //return as input instead of printing it
                                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                                //execute curl request
                                $result = curl_exec($ch);
                                //close curl connection
                                curl_close($ch);
                                //print result
                                print_r($result);
                            
  
                                jQuery(document).ready(function () {
                                    jQuery.ajax({
                                    url: "http://pdocrud.com/RESTP/api/orders/",
                                    contentType: 'application/json',
                                    success: function (response) {
                                        console.log(response);
                                        jQuery("#js_input").text(response);
                                    }
                                });
                            });