QNA > H > How To Post Data To Firebase With A Curl Command Using Php

How to post data to Firebase with a curl command using PHP

A very simply google search for your exact question lead me to a Stack Overflow post How to post data to firebase using PHP? with a solution.

Solution is:

  1. = '{"id": "6"}'; 
  2.  
  3. = "https://test.firebaseio.com/test_api/types.json"; 
  4. = curl_init(); 
  5. curl_setopt(, CURLOPT_URL, );  
  6. curl_setopt(, CURLOPT_RETURNTRANSFER, true); 
  7. curl_setopt(, CURLOPT_POST, 1); 
  8. curl_setopt(, CURLOPT_POSTFIELDS, ); 
  9. curl_setopt(, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); 
  10. = curl_exec(); 
  11. if(curl_errno()) 
  12. echo 'Curl error: ' . curl_error(); 
  13. curl_close(); 

Firebase accept json object and you have to post as json object. E puoi usare Content-Type: application/x-www-form-urlencoded o Content-Type: text/plain

Il merito della risposta va all'utente isuru su Stack Overflow.

Di Volnay

How to display a PDF as an image in HTML :: Che sapore ha la carne umana?
Link utili