Tony33 Tony33 - 1 month ago 5x
PHP Question

Http request via PHP

I have this code, usable via shell, but support told me it can be used in php too as http request. Can you tell me how?

curl --include \
--request DELETE \
--header "Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj" \{notificationId}?app_id={appId}

Thank you


Well, I see you argue with wax cage quite a bit, but yet you were friendly with me and my comment, so here goes.

Stackoverflow requires some basic understanding of the functions/api you try to use, using shortways and stackoverflow to code your code wont turn out well :-)

for CURL and the web and the PHP library, its setopt():

$curl = curl_init($url . "/Contacts/{$recordId}");
$curl = curl_init($url . "/Contacts/{$recordId}");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json',"OAuth-Token: $token"));

// Make the REST call, returning the result
$response = curl_exec($curl);
if (!$response) {
   die("Connection Failure.n");

( Taken from )

Please lookup the oAuth token documentation, but I strongly guess your hash from the op goes there.