Помогите с отправкой граффити в контакт. Приведенный ниже код не работает... PHP: function authGraffity($login, $pass) { $login = urlencode($login); $pass = urlencode($pass); $ch = curl_init('http://login.vk.com/?act=login'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3'); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_REFERER, 'http://vkontakte.ru/'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "email=$login&pass=$pass&expire=&vk="); $res = curl_exec($ch); if(preg_match('#name=\'s\' id=\'s\' value=\'(.*)\'#', $res, $s)) return $s[1]; else return false; } function sendGraffity($id, $gid, $filename, $cook) { $url = 'http://vkontakte.ru/graffiti.php?to_id='.$id.'&group_id='.$gid; $url_info=parse_url($url); $port = isset($url_info['port']) ? $url_info['port'] : 80; $socket = fsockopen($url_info['host'], $port, $errno, $errstr, 30); $pngSig = md5(substr(base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'].'/vkgraff'.$filename)), 0, 1024)); $load2 = '----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST \r\n' . 'Content-Disposition: form-data; name="Signature"\r\n\r\n' . 'thefucking32bits.idontknowwhatwr\r\n' . '----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST\r\n' . 'Content-Disposition: form-data; name="Filedata"; filename="graffiti.png" \r\n' . 'Content-Type: image/png \r\n\r\n'; $load1 = 'POST http://vkontakte.ru/graffiti.php?to_id='.$id.'&group_id='.$gid.' HTTP/1.1 \r\n' . 'Host: vkontakte.ru \r\n' . 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;) Firefox/2.0.0.3 \r\n' . 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/*;q=0.5 \r\n' . 'Accept-Language: ru,en-us;q=0.7,en;q=0.3 \n' . 'Accept-Encoding: gzip,deflate \n' . 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7 \r\n' . 'Keep-Alive: 300 \n' . 'Connection: keep-alive \n' . 'Cookie: remixlang=0; remixclosed_tabs=0; remixchk=5; remixid='.$cook.'\n' . 'Referer: http://vkontakte.ru/swf/Graffiti.swf?12 \r\n' . 'Content-type: multipart/form-data; boundary=--OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST \r\n' . 'Content-Length: '; $tmp = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/vkgraff'.$filename); $value = $load1 . strval(strlen($tmp)+strlen($load2)+43).'\r\n\r\n'.str_replace($load2, 'thefucking32bits.idontknowwhatwr', $pngSig); $postValue = $value . $tmp . '\r\n----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST \r\n'; fputs($socket, $postValue); while(!feof($socket) or ($eoheader==true)) { if($header = fgets($socket, 1024)) { if ($header == "\r\n") { $eoheader = true; break; } else { $header = trim($header); } $format=0; if($format == 1) { $key = array_shift(explode(':',$header)); if($key == $header) { $headers[] = $header; } else { $headers[$key]=substr($header,strlen($key)+2); } unset($key); } else { $headers[] = $header; } } } return $headers; } $cook = authGraffity('qwerty@qwerty.ru', 'qwerty'); sendGraffity('123456', '0', '/graffity.png', $cook); header("Location: http://vkontakte.ru/graffiti.php?act=last");
ну я как бы это понимаю, она там и лежит) скрипт перенаправляет на страницу vkontakte.ru/graffiti.php?act=draw&to_id=123456, то есть на страницу с редактором граффити, предлагая нарисовать новое...