このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
Tag Cloud
このページへのアクセス
今日: 4 / 昨日: 1
総計: 377
- Dokuwiki.fl8.jp(479)
- 13 CentOS6メール設定(24)
- FreeBSD カーネル再構築(22)
- 05 rsync(21)
最近の更新
このページへのアクセス
今日: 4 / 昨日: 1
総計: 377
$conn = curl_init(); curl_setopt($conn, CURLOPT_URL, $url); curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($conn, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($conn, CURLOPT_TIMEOUT, 5); curl_setopt($conn, CURLOPT_HEADER, FALSE); $ret = curl_exec($conn); curl_close($conn); $result = json_decode($ret, true); return $result;
curl_setopt($conn, CURLOPT_USERPWD, "User:Password");
$cookie=tempnam(sys_get_temp_dir(),'cookie_'); $conn = curl_init(); curl_setopt($conn, CURLOPT_COOKIEJAR,$cookie); curl_setopt($conn, CURLOPT_URL, $url); curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($conn, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($conn, CURLOPT_TIMEOUT, 5); curl_setopt($conn, CURLOPT_HEADER, FALSE); $ret = curl_exec($conn); curl_close($conn); unlink($cookie); $result = json_decode($ret, true); return $result;
$PASSWORD = 'hogehoge';
$USERNAME = 'hoge';
$POST_DATA = array(
'foo' => 'bar'
);
$conn = curl_init();
curl_setopt($conn, CURLOPT_URL, $url);
curl_setopt($conn, CURLOPT_POST, TRUE);
curl_setopt($conn, CURLOPT_POSTFIELDS, http_build_query($POST_DATA));
curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($conn, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($conn, CURLOPT_TIMEOUT, 5);
curl_setopt($conn, CURLOPT_HEADER, FALSE);
curl_setopt($conn, CURLOPT_USERPWD, $USERNAME . ":" . $PASSWORD);
$ret = curl_exec($conn);
curl_close($conn);
curl_error($conn);
CURLOPT_TIMEOUT/CURLOPT_CONNECTTIMEOUTでオーバーライドしない限り、CURLはdefault_socket_timeoutに従います。
$socket_timeout = ini_get('default_socket_timeout'); // timeout in seconds