mam kod który mnie loguje do tumblr'a:
include ('simple_html_dom.php'); function get_data($url, $post=null, $header=false, $cookie=null){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if($header) curl_setopt($ch, CURLOPT_HEADER, true); if($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie); return curl_exec($ch); } // function add_postfields($data, &$post){ $site = new DOMDocument(); @$site->loadHTML($data); $inputs = $site->getElementsByTagName('input'); foreach($inputs AS $input){ if($input->hasAttribute('name')){ switch($input->getAttributeNode('name')->value){ case 'recaptcha_public_key': $post['recaptcha_public_key'] = $input->getAttributeNode('value')->value; break; case 'recaptcha_response_field': $post['recaptcha_response_field'] = $input->getAttributeNode('placeholder')->value; break; case 'http_referer': $post['http_referer'] = $input->getAttributeNode('value')->value; break; case 'form_key': $post['form_key'] = $input->getAttributeNode('value')->value; break; } } } } // function get_cookies($data){ } // function tumblr($url, $email, $password){ 'user[email]' => $email, 'user[password]' => $password, 'user[age]' => 50, 'user[tos]' => 1 ); add_postfields(get_data('http://www.tumblr.com/login', http_build_query($post)), $post); $cookie = get_cookies(get_data('http://www.tumblr.com/login', http_build_query($post), true), $post); return get_data($url, null, false, $cookie); } $url = 'http://www.tumblr.com/new/blog'; $email = 'a@b.pl'; $password = '123'; $data = tumblr($url, $email, $password);
Ale za cholerę nie mogę ogarnąć dodawnia nowego bloga, będę wdzięczny jak ktoś pomoże.