first commit
This commit is contained in:
40
backend/ride/rides/test_notification.php
Executable file
40
backend/ride/rides/test_notification.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// test_socket_dispatch.php
|
||||
|
||||
$socketUrl = "http://188.68.36.205:2021";
|
||||
$INTERNAL_KEY = trim(file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||
|
||||
// جرّب Driver ID موجود عندك
|
||||
$driverId = 691;
|
||||
$rideId = 99999;
|
||||
|
||||
// payload تجريبي (بنفس شكل اللي عم تبعته بالـ add_ride)
|
||||
$payload = ["32.11153","36.0668","173.00","32.12207","36.06351","1.8064","","849a9faf3e68c1aeb708",
|
||||
"حمزه عايد","TOKEN","963992952235","1.8064","1","false","1.8064","3","692","","","3","false",
|
||||
"32.11153499923237,36.06680665165186","","","","","173.00","28.00","963992952235@intaleqapp.com",
|
||||
"وادي أكيدر","وادي أكيدر","Fixed Price","0.00","5.0"];
|
||||
|
||||
$postData = [
|
||||
'action' => 'dispatch_order',
|
||||
'drivers_ids' => json_encode([$driverId]),
|
||||
'ride_id' => $rideId,
|
||||
'payload' => $payload
|
||||
];
|
||||
|
||||
$ch = curl_init($socketUrl);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-internal-key: $INTERNAL_KEY"]);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
die("Curl error: " . curl_error($ch));
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
echo "HTTP Code: $httpCode\n";
|
||||
echo "Response: $response\n";
|
||||
Reference in New Issue
Block a user