Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Como usa a API ? #9

Closed
candidoalbertosilva opened this issue Jan 19, 2017 · 1 comment
Closed

Como usa a API ? #9

candidoalbertosilva opened this issue Jan 19, 2017 · 1 comment

Comments

@candidoalbertosilva
Copy link

tem como postar um exemplo com CURL de como usar ela. com a parte do usuario e senha.

@candidoalbertosilva
Copy link
Author

candidoalbertosilva commented Feb 21, 2017

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://ENDEREÇO DA LOJA/api/json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);

$arrayjson = array(
	'resource' => "catalog_category.info",

);
$json = json_encode($arrayjson);

curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	"Content-Type: application/json;charset=utf-8",
	"apiUsername: USERNAME",
	"apiKey: APIKEY",
	"Accept: application/json"
));
$response = curl_exec($ch);
curl_close($ch);

print_r($response);

Código Exemplo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant