$ch = curl_init();
// form field separator
$delimiter = '-------------' . uniqid();
$data = array(
'biNo' => '{$biNo}'
);
$data2 = '';
// populate normal fields first (simpler)
foreach ($data as $name => $content) {
$data2 .= "--" . $delimiter . "\r\n";
$data2 .= 'Content-Disposition: form-data; name="' . $name . '"';
// note: double endline
$data2 .= "\r\n\r\n";
$data2 .= $content . "\r\n";
}
// last delimiter
$data2 .= "--" . $delimiter . "--";
$length = strlen($data2);
$header_data = [
'Host: ',
'Content-Type: multipart/form-data; boundary=' . $delimiter,
'Cookie: ',
'Content-Length: ' . $length
];
$url = "";
curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($ch, CURLOPT_SSLVERSION, 3);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header_data);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data2);
curl_setopt ($ch, CURLOPT_POST, true);
$response = curl_exec($ch);
'Backend > PHP' 카테고리의 다른 글
XML to JSON (NOCDATA) (0) | 2020.09.21 |
---|---|
MYSQL PASSWORD와 비밀번호 비교 (0) | 2020.09.02 |
금액을 한글로 변환 (0) | 2020.07.10 |
PHP Debug Print (0) | 2020.06.26 |
아스키코드 제어문자 삭제 (0) | 2020.05.22 |