Come ottenere l’elenco dei prodotti registrati tramite API?
URL: http://www.namedoseusite.com.br/api_products_ots.php?action=list_products
parametro header | formato |
usuario1 | base64_encode () |
password1 | base64_encode () |
parametro | formato | Descrizione |
stato | get |
1, 2 o 3 |
Search_model | get | Modello di prodotto |
Search | get | Nome prodotto |
categoria | get | Numero di categoria è richiesto solo il numero |
sort_order | get | Lucky Order di: sort_product_name sort_date_added sort_date_updated sort_code sort_quantity sort_price sort_besteseller < /td> |
campione PHP:
$ add_query_order = ' ' ;;
if ($ _get [' status ']! = ' ') {
$ add_query_order. = ' & amp; status = ' $ _ get [' status '];
}
if ($ _get [' search_model ']! = ' ') {
$ add_query_order. = ' & amp; search_model = ' $ _ get [' search_model '];
}
if ($ _get [' Search ']! = ' ') {
$ add_query_order. = ' & amp; search = ' $ _ get [' Search '];
}
if ($ _get [' categoria ']! = ' ') {
$ add_query_order. = ' & amp; categoria = ' $ _ get [' categoria '];
}
if ($ _get [' sort_order ']! = ' ') {
$ add_query_order. = ' & amp; sort_order = ' $ _ get [' sort_order '];
}
$ Url = $ tabain_url. ' /pi_seller_products_thers.php? Action = list_products ' ;. $ add_query_order;
$ Ch = curl_init ($ url);
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);
// Prodotti di elenco di campioni EOF re>
return:
Products_id
Immagine
Nome
Modello
Quantità
Stato
date_added
last_modified