facebook twitter hatena line google mixi email

Php/curl/基本

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

$post["hoge"] = "piyo";
$chost = curl_init();
curl_setopt($chost, CURLOPT_URL, "ttp://example.com/hogehoge.php");
curl_setopt($chost, CURLOPT_POST, true); // methodをpostに
curl_setopt($chost, CURLOPT_POSTFIELDS, $post);
curl_setopt($chost, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($chost);
curl_close($chost);
echo $result;