fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. // 1. URL DEL TUO WEBHOOK (Assicurati che sia il TEST URL)
  9. string url = "http://e...content-available-to-author-only...s.org:5678/webhook-test/8845bae0-9e81-423a-adc5-8c523733140e";
  10. string nome;
  11.  
  12. cout << "--- SKIFIDOR PLUS: TEST INVIO POST ---" << endl;
  13. cout << "Inserisci nome: ";
  14. getline(cin, nome);
  15.  
  16. // 2. COMANDO POST AGGIORNATO
  17. // -i: mostra l'intestazione della risposta (per vedere se riceve 200 OK o 404)
  18. // -X POST: forza il metodo POST
  19. // -H: dice a n8n che stiamo inviando JSON
  20. string comando = "curl -i -X POST " + url +
  21. " -H \"Content-Type: application/json\" " +
  22. " -d \"{\\\"nome\\\":\\\"" + nome + "\\\"}\"";
  23.  
  24. cout << "\n[DEBUG] Comando inviato: " << comando << endl;
  25. cout << "\n--- RISPOSTA DAL SERVER ---" << endl;
  26.  
  27. // Esecuzione
  28. int exitCode = system(comando.c_str());
  29.  
  30. cout << "\n---------------------------" << endl;
  31. cout << "[DEBUG] Codice d'uscita sistema: " << exitCode << endl;
  32.  
  33. if(exitCode != 0) {
  34. cout << "[ERRORE] Il comando curl non è riuscito a connettersi a internet." << endl;
  35. }
  36.  
  37. return 0;
  38. }
Success #stdin #stdout #stderr 0.02s 12752KB
stdin
eric
stdout
--- SKIFIDOR PLUS: TEST INVIO POST ---
Inserisci nome: 
[DEBUG] Comando inviato: curl -i -X POST http://e...content-available-to-author-only...s.org:5678/webhook-test/8845bae0-9e81-423a-adc5-8c523733140e -H "Content-Type: application/json"  -d "{\"nome\":\"eric\"}"

--- RISPOSTA DAL SERVER ---

---------------------------
[DEBUG] Codice d'uscita sistema: 1536
[ERRORE] Il comando curl non è riuscito a connettersi a internet.
stderr
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: ercn8n.duckdns.org