CakePHP - HttpSocket
8
HttpSocket Aprenda a fazer conexão com WebServies externos por meio da classe HttpSocket
Transcript of CakePHP - HttpSocket
![Page 1: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/1.jpg)
HttpSocketAprenda a fazer conexão com WebServies externos por meio da classe HttpSocket
![Page 2: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/2.jpg)
CONCEITUANDO
• HttpSocket é também uma alternativa ao CURL, a vantagem desta classe é que ela simplifica bastante o processo de comunicação com o servidor externo.
• A classe está em Network/Http e você precisa chama-la com um App::uses('HttpSocket', 'Network/Http');
![Page 3: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/3.jpg)
MÉTODOS
• GET
• POST
• PUT
• DELETE
![Page 4: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/4.jpg)
EXEMPLO
![Page 5: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/5.jpg)
EXEMPLO
![Page 6: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/6.jpg)
COMPARAÇÃO COM CURL
![Page 7: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/7.jpg)
ALGUNS MÉTODOS
• body()
• isOk()
• getHeader()
• isRedirect()
![Page 8: CakePHP - HttpSocket](https://reader036.fdocumentos.com/reader036/viewer/2022082607/55b3ce4fbb61eb6d3c8b47bb/html5/thumbnails/8.jpg)
ONDE ME ENCONTRAR
• @luisfredgs
• http://www.facebook.com/luisfredweb
• http://www.youtube.com/luisfredvideos
• http://www.luisfred.com.br