に送信する方法この問題をここ数日間解決しようとしており、手がかりがありません。 別のWebサイトにリクエストを送信する必要があります。 私はそのサイトのcaptchaも使用しているので、私はリクエストを送信するためにクッキーを取得する必要があります。 これは私のコードです。 初めてリクエストを送信したときにクッキーを保存する方法と、そのクッキーを設定してPOSTリクエストとともにそのウェブサイトに送信する方法はありますか?POSTリクエストでCookieを他のサイト、PHP
あなたの答えをありがとう、私は質問が基本的であることを知っているが、私は何も組み合わせることはできません。
$d = $_REQUEST["date"];
$t = $_REQUEST["table"];
$r = $_REQUEST["registration"];
$url = 'https://www.huo.hr/hrv/provjera-osiguranja/11/';
$data = array('date' => "$d", 'city' => "$t", 'reg1' => "$r", 'security_code' => 'ffff');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded \r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
echo "error";
} else {
echo "<div style='overflow-y: scroll; height:400px;'>" . $result ."</div>";
}
の場合、file_get_contentsではなくcurlを使用する必要があります。 btwなぜrecaptcha? –