프로그램.코딩

php curl, fcm, 소켓통신등

landzz 2018. 6. 8. 16:28

php 원격서버 통신하면서 만들어뒀던 라이브러리 정리.



curl 을 이용하지않고 php socket 를 이용한방식은 아래를 참고(php4 호환)


http://landzz.com/102?category=93332




curl GET 통신 (일반적인 용도)


그냥 평범한 사용


https://gist.github.com/landzz/9d0c0ce752f792cec433260e8d06608a


curl POST 통신 (일반post : form urlencoded )


그냥평범한 사용


https://gist.github.com/landzz/882ed1a9826928e18a065fa0a532e930



curl POST 파일첨부 (multipart/formdata)


https://gist.github.com/landzz/99e3e07955fe889046113a0e90e1acb1



기타 : curl 로 fcm 보내기... 후닥닥만듬


fcm 참고 : https://firebase.google.com/docs/cloud-messaging/send-message?hl=ko


- fcm 은 header 에 authorization 토큰(을 추가해야함, 전송타입 application/json

- body 는 json string 를 넣는다.


##sample