curl kütüphanesi aktif değil kodda bir sıkıntı yok
ben denedim çalışıyor
<?php
$ch=login();
$html=downloadUrl('http://www.theknot.com/Vendors/Christine-Paul-Events/Profile/WCS/091/367999/profile', $ch);
echo $html;
function downloadUrl($Url, $ch){
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
return $output;
}
function login(){
$user_id = "eposta@adresi.com";
$user_password = "sifre";
$cookie_file_path = "tmp/cookies.txt";
$LOGINURL = "http://global.theknot.com/join/MemberLogin.aspx";
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
$matches = array();
preg_match('/<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="([^"]*?)" \/>/', $result, $matches);
$viewstate = $matches[1];
$matches2 = array();
preg_match('/<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="([^"]*?)" \/>/', $result, $matches2);
$validation = $matches2[1];
curl_close ($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://global.theknot.com/join/Sites/theknot/memberlogin.aspx'); //login URL
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
$postData='
__LASTFOCUS=
&__EVENTTARGET=
&__EVENTARGUMENT=
&__EVENTVALIDATION='.urlencode($validation).'
&__VIEWSTATE='.urlencode($viewstate).'
&ctl00$MainContent$emailTextBox='.$user_id.'
&ctl00$MainContent$passwordTextBox='.$user_password;
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$store = curl_exec ($ch);
return $ch;
}
?>