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'}};
$.ajax({
url : "https://formanurl/api/v2/compute_resources",
data : myarray,
success: function(html){
alert(html);
},
error: function(html){
alert(html);
$("#result").html(html);
}
});

tell me soon

Parveen,

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

-Chris