알짜게시판

[PHP] Curl 을 이용하여 json 을 post 보내기

$url : 보낼 주소

$dat : 보낼 데이터

[code]
$url = 'https://abc.com/json';
$dat = ['mode'=>'get'];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dat));
$rst = json_decode(curl_exec($ch), true);
curl_close($ch);
[/code]

번호 제목 글쓴이 조회 날짜
58 [PHP] REQUEST 값 받기(application/json 포함) 4,528 04-20
57 [Linux] 데몬(systemd service) 작성 및 실행하기 28,365 03-14
56 [MySQL] 업데이트 이후 에러 발생([ERROR] Incorrect definition of table … 90,369 12-08
55 구글 크롬 탭검색 비활성화 71,013 12-04
54 [MySQL] MySQL, MariaDB 업데이트 72,760 11-24
53 [아이폰] HTTPS 감청 우회하기 100,703 11-01
52 Windows에 Rust 설치하기 56,510 10-05
51 [ReactNative] android directory was detected in the project. 64,670 07-20
50 [리눅스] 메일(Mail) 삭제/초기화 57,390 07-18
49 [Delphi] 윈도우 알림센터에 메시지 출력하기 54,530 06-20
48 텔레그램 봇 (Telegram Bot) 만들기 37,251 05-03
47 [부트스트랩] nav 에서 하위 항목 활성화 시 부모 항목 활성화 34,357 04-30
46 [리눅스] PHP 버전 추가하기 34,007 04-29
45 [PHP] Curl 접속 속도가 늦은 경우 35,680 04-10
44 [윈도우] 파일 내용 검색 45,034 02-09
43 [MySQL] unblock with 'mysqladmin flush-hosts' 에러 53,000 01-01
42 [ReactNative] 캐시 초기화 하는 방법 55,439 12-27
41 [윈도우] node.js 와 npm 업데이트(업그레이드) 56,745 12-01
40 [윈도우] 윈도우11 시작 메뉴 위치 변경(가운데, 왼쪽) 59,893 10-10
39 [Delphi] 중복 실행 방지 58,391 09-21
38 [리눅스] yum 에서 Thread died in Berkeley DB library 오류 58,100 09-18
37 [리눅스] VNSTAT 설치하기 55,496 09-17
36 [리눅스] 로그 삭제 및 비우기(?) 56,847 09-09
35 [FTP] 500 Illegal PORT command. 46,684 09-03
34 [리눅스] .htaccess 를 이용해서 https 이동하기 44,862 08-31
33 [PHP] Imagek 를 이용한 썸네일 생성 45,304 08-26
32 [그누보드] 1364 : Field 'xxxxx' doesn't have a default value 44,755 08-20
31 [리눅스] 윈도우 프로그램 실행 (centos7, wine 7.0) 44,177 08-09
30 [윈도우] IPv6 켜기, 끄기 43,425 08-03
29 [그누보드] 회원 가입일 기준으로 이용기간 정하기 40,717 07-28
28 [그누보드] sql_fetch, sql_query 안쓰고 직접 mysql 사용하기 40,350 07-24
목록