Integration of foreman with php

I want to create new compute_resources with foreman api in PHP. How can
i do that (Any code example).

Currently i am doing in ajax in this way
var myarray = {compute_resource: { name: 'name', provider: 'provider',
description: 'description'}};
url : "https://formanurl/api/v2/compute_resources",
data : myarray,
success: function(html){
error: function(html){

tell me soon


The Foreman API is RESTful; so you should be able to use PHP's standard
libraries to query the API.

The docs can be found here: Foreman :: API v2
Compute resource is here:
API documentation