function login( $url, $login, $pass ) {
$ch = curl_init();
if ( strtolower( (substr( $url, 0, 5 )) == 'https' ) ) {
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
}
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_REFERER, $url );
curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, array(
'authEmail' => $login,
'authPassword' => $pass,
));
curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4" );
curl_setopt( $ch, CURLOPT_HEADER, 0 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_COOKIEJAR, dirname( __FILE__ ) . '/cookie.txt' );
curl_setopt( $ch, CURLOPT_COOKIEFILE, dirname( __FILE__ ) . '/cookie.txt' );
$result = curl_exec( $ch );
$info = curl_getinfo( $ch );
$error = curl_error( $ch );
curl_close( $ch );
return $result;
} |