방법1
复aze代码 代码如下:
$ch = cur_init();
curl_setopt($ch, CURLOPT_URL, "http://192.168.1.135/turntable/get_jump.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
curl_exec($ch);
curl_close($ch);
방법2
复代代码 代码如下:
$data['uid'] = $this->uid;
$data['노력'] = $res['노력'];
$data['breakthrough'] = $res['breakthrough'];
$data['target'] = $res['target'];
$str = '';
foreach ($data as $k=>$v) {
if (is_array($v)) {
foreach ($v as $kv => $vv) {
$ str .= '&' . $k . '[' . $kv . ']=' . Urlencode($vv);
}
} else {
$str .= '&' . $k . '=' . Urlencode($v);
}
}
$context =
array('http' =>
array('method' => 'POST',
'header' => ' 콘텐츠 유형: application/x-www-form-urlencoded'."rn".
'User-Agent: Manyou API PHP 클라이언트 0.1(비컬) '.phpversion()."rn".
'콘텐츠 길이: ' . strlen($str),
'content' =>
$contextid = stream_context_create($context);
$sock = fopen('http://192.168.1.135/turntable/get_jump.php', 'r', false, $contextid);
if ($sock) {
$result = '';
while (!feof($sock)) {
$result .= fgets($sock, 4096);
}
fclose($sock);