그냥 개발자 블로그

php curl post 통신 본문

프로그래밍팁/php

php curl post 통신

마음이파파 2018. 6. 17. 03:30

보내는 쪽


$url = 'http://xxxx.com';

$post['data'] = 'data';


$ch = @curl_init();


curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_POST, true);  

 curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$res = curl_exec ($ch);


curl_close ($ch); // Close cURL handle


ver_dump($res);

 




받는 쪽


if($_POST['data']){

echo 'Success : '.$_POST['data'];

}else{

echo 'Fail';

}

 








[문의하기]



copyright ⓒ 2018. 워크식스