ANTICHAT.XYZ    VIDEO.ANTICHAT.XYZ    НОВЫЕ СООБЩЕНИЯ    ФОРУМ  
Баннер 1   Баннер 2
Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей. Здесь обсуждаются безопасность, программирование, технологии и многое другое. Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
Вернуться   Форум АНТИЧАТ > Программирование > PHP, PERL, MySQL, JavaScript
   
 
 
Опции темы Поиск в этой теме Опции просмотра

Заливка фотки на сервак контакта PHP вопрос
  #1  
Старый 18.06.2009, 17:31
Аватар для R1der23
R1der23
Новичок
Регистрация: 28.07.2008
Сообщений: 25
Провел на форуме:
139293

Репутация: 0
Отправить сообщение для R1der23 с помощью ICQ
По умолчанию Заливка фотки на сервак контакта 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

что есть отрицательныфй результат загрузки.. раньше сталкивался с загрузкой фоток все получалось.. но тут уже два дня парюсь.. никак не получается.. помогите.. в чем моя ошибка.. все прочие параметры типа хэша и прочего передаем.. все ок.. заранее спасибо
 
Ответить с цитированием
 



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Proxy FAQ foreva Чужие Статьи 12 04.01.2008 12:15
На PHP, как на "Новые ворота"... Mertvii-Listopad Чужие Статьи 7 18.09.2006 12:42
Вопрос по Php и Html Archie PHP, PERL, MySQL, JavaScript 9 26.05.2006 16:43
еще один вопрос по php Utochka PHP, PERL, MySQL, JavaScript 6 26.03.2006 11:26
Вопрос по php Laggi Форумы 10 08.09.2005 21:50



Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT.XYZ