To login to the site I have used this. But after successfully login that how can i redirect to a page as i want in the website.
For login by php curl i used this.
$loginUrl = 'https://secure.propertyshark.com/mason/Accounts/logon.html';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginUrl);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "email=myemail@hotmail.com&password=mypassword");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
$cookie = getcwd().DIRECTORY_SEPARATOR.'cookie.txt';
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
$answer = curl_exec($ch);
if (curl_error($ch)) {
echo curl_error($ch);
}
curl_setopt( $ch, 'http://www.propertyshark.com/mason/Property/619443/133-32-244-St-Queens-NY-11422/');
echo $answer;
But i am not sure it is working or not, So i want how can i confirm about login and redirect to "'http://www.propertyshark.com/mason/Property/619443/133-32-244-St-Queens-NY-11422/" page.
Now i am using this, but not working.
<?php
$loginUrl = 'https://secure.propertyshark.com/mason/Accounts/logon.html';
$ch1 = curl_init();
$cookie = getcwd().DIRECTORY_SEPARATOR.'cookie.txt';
curl_setopt($ch1, CURLOPT_URL, $loginUrl);
curl_setopt($ch1, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch1, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch1, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
curl_setopt($ch1, CURLOPT_POST, true);
curl_setopt($ch1, CURLOPT_POSTFIELDS, "email=myemail@hotmail.com&password=password");
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_COOKIESESSION, true);
$next_page = 'http://www.propertyshark.com/mason/Property/619443/133-32-244-St-Queens-NY-11422/';
$ch2 = curl_init();
$cookie = getcwd().DIRECTORY_SEPARATOR.'cookie.txt';
curl_setopt($ch2, CURLOPT_URL, $next_page);
curl_setopt($ch2, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch2, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false);
$answer = curl_exec($ch2);
if (curl_error($ch2)) {
echo curl_error($ch2);
}
echo $answer;