mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-04 17:04:53 +02:00
retapage accueil, gestion de Demandes
This commit is contained in:
parent
d777221d0d
commit
f4c5e048ff
26 changed files with 2498 additions and 292 deletions
48
test_city_followup.php
Normal file
48
test_city_followup.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
// Test script for the new city-followup API endpoint
|
||||
|
||||
// Replace with your actual Symfony application URL
|
||||
$url = 'http://localhost:8000/api/city-followup';
|
||||
|
||||
// Test data
|
||||
$data = [
|
||||
'insee_code' => '75056', // Example INSEE code for Paris
|
||||
'measure_label' => 'test_measure',
|
||||
'measure_value' => 42.5
|
||||
];
|
||||
|
||||
// Function to make a POST request
|
||||
function makePostRequest($url, $data) {
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => http_build_query($data)
|
||||
]
|
||||
];
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
|
||||
if ($result === FALSE) {
|
||||
echo "Error making request\n";
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// First request should succeed
|
||||
echo "Making first request...\n";
|
||||
$response = makePostRequest($url, $data);
|
||||
echo "Response: " . $response . "\n\n";
|
||||
|
||||
// Second request within an hour should fail
|
||||
echo "Making second request (should fail due to 1-hour limit)...\n";
|
||||
$response = makePostRequest($url, $data);
|
||||
echo "Response: " . $response . "\n\n";
|
||||
|
||||
// Try with a different measure label (should succeed)
|
||||
echo "Making request with different measure label...\n";
|
||||
$data['measure_label'] = 'another_test_measure';
|
||||
$response = makePostRequest($url, $data);
|
||||
echo "Response: " . $response . "\n";
|
Loading…
Add table
Add a link
Reference in a new issue