このサイトでは、Curlで自動的にログインしようとしています:https://online.hinode.com.br、コンサルタントIDは、常に同じステータスと一緒に自動的に入力する必要があります。ログイン後、特定の製品ページにリダイレクトする必要があります。しかし、私がテストしたコードはどこにも行きませんでした!エラーはありません、htmlはロードされません...私はそれがこの選択フィールドであるべきだと思います。入力フィールドの1つであるCurlによる自動ログイン
コード:
<?php
// Start cURL
$ch = curl_init();
// Define the original URL (of the login form)
curl_setopt($ch, CURLOPT_URL, 'https://online.hinode.com.br/');
// Enable POST protocol
curl_setopt ($ch, CURLOPT_POST, 1);
// Define the parameters that will be sent (user and password for example)
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'loja_consultor=fulano&estado=SP');
// Imitate the boss behavior of browsers: handle cookies
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
// Set the transfer type (Padrão: 1)
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// Execute the requisition
$store = curl_exec ($ch);
// Define a new URL to be called (after login)
curl_setopt($ch, CURLOPT_URL, 'https://online.hinode.com.br/detalhes.asp?IdProduto=769&ssp=830852727SSP20171218HP115020');
// Execute the second request
$content = curl_exec ($ch);
//閉じるcURLの curl_close($ chを);
ありがとうございます!
Downvotingを。 – pepperjack
メインのスタックオーバーフローサイトに関する質問は英語で行う必要があります。[pt.so]を試してください。 – jmoerdyk
Stack: –