I have a Yii application without mod rewrite, the controller need to be set in URL : ?r=controller/action
In the application : i want to create a system for Event Wehook
I add this link https://example.com/?r=sendgrid/action to app.sendgrid.com/settings/parse : the action never happen : link never call (i just log it on a file for checking : direct call work like a charm).
I test on another way i create a checksendgrid.php file with
<?php
$postedValues = $_POST;
$gettedValues = $_GET;
$values = [
'post' => $postedValues,
'get' => $gettedValues,
];
$result = file_put_contents(
'/var/log/test/sendgrid.log',
json_encode($values),
FILE_APPEND | LOCK_EX
);
file_put_contents(
'/var/log/test/sendgrid.log',
"\n",
FILE_APPEND | LOCK_EX
);
$data = file_get_contents("php:/input");
$events = json_decode($data, true);
if(!empty($events)) {
foreach ($events as $event) {
$result = file_put_contents(
'/var/log/test/sendgrid.log',
json_encode($event),
FILE_APPEND | LOCK_EX
);
file_put_contents(
'/var/log/test/sendgrid.log',
"\n",
FILE_APPEND | LOCK_EX
);
}
}
file_put_contents(
'/var/log/test/sendgrid.log',
"\n",
FILE_APPEND | LOCK_EX
);
Set this file on parse settings example.org/checksendgrid?param=ok
and get only on log :
{"post":[],"get":[]}
{"bounce_classification":"Unclassified","category":["survey:441148"],"email":"invalid@mailinvalide-example.com","event":"bounce","ls-survey":"441148","ls-tid":"3","ls-token":"ezrzer","reason":"unable to get mx info: failed to get IPs from PTR record: lookup <nil>: unrecognized address","sg_event_id":"Ym91bmNlLTQtMzUyODUzODAtOFI1eTZKb3JSZjZTV01oaUI1Zlg1US0w","sg_message_id":"8R5y6JorRf6SWMhiB5fX5Q.filterdrecv-d7bbbc8bf-pldp9-1-64BA8FFE-40.0","smtp-id":"<kQboWY6eRJIzjnFpAw9q6xi1Ly4y2AwskpgEYQkK9Ek@oecd-dev.sondages.pro>","timestamp":1689948459,"tls":0,"type":"blocked"}
Is ther a way to have GET parameters in Inboud parse ?
I finally move to Inbound Parse : https://docs.sendgrid.com/for-developers/parsing-email/setting-up-the-inbound-parse-webhook Here , it work.
Thanks