CURL_FIXED.md 2.1 KB

Commandes CURL corrigées

⚠️ Problèmes identifiés

  1. Serveur web non démarré : Le port 80 n'est pas accessible
  2. Syntaxe incorrecte : Utilisation de backticks PowerShell (`) dans CMD

✅ Solutions

Option 1 : Démarrer un serveur PHP local

REM Dans un terminal séparé, démarrer le serveur :
cd C:\Users\USER\Documents\Intersel\dev\Lucca
php -S localhost:8000 -t api

Puis dans un autre terminal :

cd C:\Users\USER\Documents\Intersel\dev\Lucca\all_json
curl -X POST "http://localhost:8000/user/user/POST_userV2.php" -H "Content-Type: application/json" -d "@post_user_request.json"

Option 2 : Utiliser le script batch automatique

cd C:\Users\USER\Documents\Intersel\dev\Lucca\all_json
start_server_and_send.bat

Option 3 : Syntaxe CMD correcte (sans serveur web)

Si vous avez déjà un serveur web (Apache/Nginx) sur le port 80 :

cd C:\Users\USER\Documents\Intersel\dev\Lucca\all_json
curl -X POST "http://localhost/api/user/user/POST_userV2.php" -H "Content-Type: application/json" -d "@post_user_request.json"

OU sur une seule ligne :

curl -X POST "http://localhost/api/user/user/POST_userV2.php" -H "Content-Type: application/json" -d "@C:\Users\USER\Documents\Intersel\dev\Lucca\all_json\post_user_request.json"

Option 4 : Utiliser PowerShell (recommandé)

cd C:\Users\USER\Documents\Intersel\dev\Lucca\all_json
curl -X POST "http://localhost/api/user/user/POST_userV2.php" `
  -H "Content-Type: application/json" `
  -d "@post_user_request.json"

📋 Différences entre CMD et PowerShell

Caractère CMD PowerShell
Continuation de ligne ^ `
Guillemets " "
Chemin \ ou / \ ou /

🚀 Solution rapide (tout-en-un)

Exécutez simplement :

cd C:\Users\USER\Documents\Intersel\dev\Lucca\all_json
start_server_and_send.bat

Ce script va :

  1. Démarrer automatiquement un serveur PHP sur le port 8000
  2. Attendre 2 secondes
  3. Envoyer la requête POST
  4. Vous permettre d'arrêter le serveur