Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
Заливка фотки на сервак контакта PHP вопрос |

18.06.2009, 17:31
|
|
Новичок
Регистрация: 28.07.2008
Сообщений: 25
Провел на форуме: 139293
Репутация:
0
|
|
Заливка фотки на сервак контакта PHP вопрос
Привет. Столкнулся с проблемой автоматической заливки фотки на сервак. Вот следующий код..
$filename="123.jpg";
$fp=fopen($filename,"r");
if ($fp!=false)
{
$bodyimage="";
while (!feof($fp)) $bodyimage.=fgets($fp,1024);
fclose($fp);
}
$buffer=connect($proxy,$proxyport,1,genmessage($se rver,3,"/profileEdit.php?page=photo",0,$cookie));
preg_match_all("/method=\"post\" action=\"http:\/\/(.*?).vkontakte.ru\/upload.php\?act=profile&(.*?)\"/is",$buffer,$path);
$post="key=profile_photo_flood&item_id=".trim($flo od[1][0]);
$buffer=connect($proxy,$proxyport,1,genmessage($se rver,4,"/captchaFlood.php",$post,$cookie));
$sendhost=$path[1][0].".$server";
$boundary="----------oQwjKuMeah9zw9GmYnadCO";
$content="--$boundary\r\n";
$content.="Content-Disposition: form-data; name=\"subm\"\r\n";
$content.="\r\n";
$content.="1\r\n";
$content.="--$boundary\r\n";
$content.="Content-Disposition: form-data; name=\"file\"; filename=\"$filename\"\r\n";
$content.="Content-Type: image/jpeg\r\n";
$content.="\r\n";
$content.=$bodyimage."\r\n";
$content.="--$boundary--";
$poststr="POST /upload.php?act=profile&".trim($path[2][0])." HTTP/1.0\r\n";
$poststr.="User-Agent: Opera/9.64 (Windows NT 6.1; U; ru) Presto/2.1.1\r\n";
$poststr.="Host: $sendhost\r\n";
$poststr.="Accept: text/html, application/xml;q=0.9, application/xhtml xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n";
$poststr.="Accept-Language: ru-RU,ru;q=0.9,en;q=0.8\r\n";
$poststr.="Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n";
$poststr.="Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n";
$poststr.="Referer: http://vkontakte.ru/profileEdit.php?page=photo\r\n";
$poststr.="Cookie: $cookie\r\n";
$poststr.="Cookie2: \$Version=1\r\n";
$poststr.="Proxy-Connection: Keep-Alive\r\n";
$poststr.="Content-Length: ".strlen($content)."\r\n";
$poststr.="Content-Type: multipart/form-data; boundary=----------$boundary\r\n\r\n";
$poststr.=$content;
echo $poststr;
$buffer=connect($sendhost,80,1,$poststr);
echo $buffer;
функция genmessage это просто генерация запроса.. на нее не смотрим.. и так собсно не грузит.. контакт возвразщает следующий результат..
HTTP/1.1 302 Found Server: nginx/0.6.32 Date: Thu, 18 Jun 2009 13:24:47 GMT Content-Type: text/html; charset=-1251 Connection: close X-Powered-By: PHP/5.2.6-1+lenny3 Pragma: no-cache Cache-control: private, must-revalidate Location: http://vkontakte.ru/profileEdit.php?page=donephoto&mid=41170479&server =955&photo=&hash=d771663a7840ff38cffd88655b81f299& message_code=0 Content-Length: 0
что есть отрицательныфй результат загрузки.. раньше сталкивался с загрузкой фоток все получалось.. но тут уже два дня парюсь.. никак не получается.. помогите.. в чем моя ошибка.. все прочие параметры типа хэша и прочего передаем.. все ок.. заранее спасибо
|
|
|
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|