-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.php
43 lines (34 loc) ยท 1.18 KB
/
request.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
if(isset($_POST["name"]))
{
$data = array('action' => $_POST["action"], 'name' => $_POST["name"], 'contents' => $_POST["contents"], 'byte' => $_POST["byte"]);
}else{
$data = array('action' => $_POST["action"]);
}
$url = 'http://poot97.dothome.co.kr/TextGenerator/action.php';
/* file_get_contents ๋ฐฉ๋ฒ ์ฌ์ฉ ( ๋ฌธ์ : ๋ณด์์ ์ค๋ฅ๊ฐ ๋ฐ์ํจ )
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data, '' , '&'),
'timeout' => 50
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
*/
/* cURL ์ฌ์ฉ */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_POST, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
//post๋ฐฉ์์ผ๋ก ๋งค๊ฐ๋ณ์ ์ ๋ฌํ์ฌ phpํ์ผ ๋ถ๋ฌ์ค๋ ๋ฐฉ๋ฒ ์ฌ์ฉ๋จ.
?>