Como consumir API com PHP — Pokemóns — Listar dados (file_get_contents e cURL)

0
27458
- CURSO FULLSTACK 15 CURSOS COMPLETOS -curso-fullstack-master-com-certificado-canalti

Consumindo API com PHP de Pokemóns — JSON

Nesse exemplo, vamos consumir uma API de pokemóns retornando em JSON e listar os dados retornados, através do file_get_contents e cURL.

A URL da API é: https://www.canalti.com.br/api/pokemons.json

Estrutura de retorno da API

Consumindo API no PHP com file_get_contents

Consumindo API no PHP com cURL

Link com todas as opções para utilizar na função curl_setopt: http://php.net/manual/pt_BR/function.curl-setopt.php

Projeto final do consumo de API no PHP com cURL retornando uma listagem de Pokemóns

Projeto final

Faça o download do projeto completo com cURL clicando aqui

Links úteis

http://php.net/manual/pt_BR/function.file-get-contents.php
http://php.net/manual/pt_BR/book.curl.php
https://json.org
https://addons.mozilla.org/pt-BR/firefox/addon/jsonview/
https://bulma.io/

- CURSO FULLSTACK 15 CURSOS COMPLETOS -curso-fullstack-master-com-certificado-canalti

DEIXE UMA RESPOSTA

Por favor insira o seu comentário!
Please enter your name here