Авторизация через curl
Здравствуйте.
Нужна помощь. Как получить ссылку на профиль при авторизации curl steam?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Заголовок</title></head>
<?php
$usereagent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8)";
function post_content($url, $postdata) {
global $usereagent;
$ch = curl_init($url);
$root_directory = dirname(__FILE__);
$cookie_file = $root_directory."/coo.txt";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $usereagent); // useragent
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
$content = curl_exec($ch);
$err = curl_errno($ch);
$errmsg = curl_error($ch);
$header = curl_getinfo($ch);
curl_close($ch);
$header['errno'] = $err;
$header['errmsg'] = $errmsg;
$header['content'] = $content;
return $header;
}
//Login in steam
//$get_url = 'https://steamcommunity.com';
$username = '***';
$passwd = '***';
$postdate = array('action' => doLogin,
'goto' => '',
'steamAccountName' => $username,
'steamPassword' => $passwd,
'x' => 23,
'y' => 11,);
$result = post_content('https://steamcommunity.com/?action=doLogout', $postdata);
echo $result;
var_dump($url);
var_dump($postdate);
?>