Come aggiungere unità di vendita tramite API?
POST: http://www.namedoseusite.com.br/api_products_thers.php?act=add_uv
parametro header | formato |
usuario1 | base64_encode () |
password1 | base64_encode () |
parametro | formato | Descrizione |
uv_name_text | json |
Nome principale dell’unità di vendita |
campione PHP
$ Url = $ tabain_url. ' /pi_products_ors.php? Action = add_uv ' ;;
$ Data = array (“uv_name_text” = & gt; “nome principale dell’unità di vendita” // Nome principale dell’unità di vendita * campo richiesto
);
$ data_string = json_encode ($ data);
$ Ch = curl_init ($ url);
CURL_SETOPT ($ CH, Curlopt_CustomRequest, “post”);
CURL_SETOPT ($ CH, CURLOPT_POSTFIELDS, $ DATA_STRING);
CURL_SETOPT ($ CH, CURLOPT_RETURNTRANSFER, TRUE);
CURL_SETOPT ($ CH, CURLOPT_SSL_VERIFYPEER, FALSE);
CURL_SETOPT ($ CH, CURLOPT_HTTPHEADER, Array (
' tipo di contenuto: Applicazione/JSON ',
“Cache-Control: No-Cache”,
' usuario1: ' . base64_encode ($ usuario1),
' password1: ' . base64_encode ($ password1),
' lunghezza del contenuto: ' . Strlen ($ data_string)))
);
$ result = curl_exec ($ ch);
CURL_CLOSE ($ CH);
print_r ($ risultato);
// campione aggiungi UV eof re>
Errore di ritorno:
codice
messaggio
Successo di ritorno:
codice
ID
messaggio