-2
我需要使用curl從我的網站登錄到 https://login.naukri.com/nLogin/Login.php?URL=http%3A%2F%2Fjobsearch.naukri.com%2Fmynaukri%2Fjs_recommends.php登錄與捲曲其他來源(eg.naukri.com)
。請幫忙。
/*
* Data which is to submitted to the remote URL
*/
$data = array();
$data['USERNAME'] = '[email protected]';
$data['PASSWORD'] = '[email protected]';
$data['formSubmitted']=1;
/*
* Prepare data for posting. That is, urlencode data
*/
$post_str = '';
foreach($data as $key=>$val) {
$post_str .= $key.'='.urlencode($val).'&';
}
$post_str = substr($post_str, 0, -1);
/*
* Initialize cURL and connect to the remote URL
* You will need to replace the URL with your own server's URL
* or wherever you uploaded this script to.
*/
$ch = curl_init();
$url="https://login.naukri.com/nLogin/Login.php?msg=0&URL=http%3A%2F%2Fmy.naukri.com";
curl_setopt($h, CURLOPT_URL, $url);
curl_setopt($h, CURLOPT_POST, true);
curl_setopt($h, CURLOPT_HEADER, false);
curl_setopt($h, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($h);
什麼是您當前的代碼和問題你正在服用的方法呢? – Fluffeh
http://whathaveyoutried.com? – alfasin