Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/topic.php on line 737
Форумы портала PHP.SU :: curl залить файл

 PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи


 Страниц (1): [1]   

> Без описания
stdm
Отправлено: 23 Июля, 2013 - 22:20:55
Post Id


Новичок


Покинул форум
Сообщений всего: 5
Дата рег-ции: Янв. 2013  


Помог: 0 раз(а)




Добрый день.
Написал скрипт на curl для работы с одним сайтом, пост\гет запросы делает корректно, но залить файл никак не могу. Соединение https.
Подскажите, плиз, кто знает какие параметры необходимо задать.

PHP:
скопировать код в буфер обмена
  1. curl_setopt($curl, CURLOPT_URL, 'http://site.ru');
  2. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  3. curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0");
  4. $headers = array(  
  5.     'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  6.         'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',  
  7.     'Content-Type: application/x-www-form-urlencoded',  
  8.     'Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1',  
  9.     'Accept-Encoding: gzip, deflate',  
  10.     'Connection: Keep-Alive');  
  11.        
  12. curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);  
  13. curl_setopt($curl, CURLOPT_HEADER, 0);  
  14. curl_setopt($curl, CURLOPT_COOKIEJAR, $cfile);  
  15. curl_setopt($curl, CURLOPT_COOKIEFILE, $cfile);  
  16. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);  
  17. curl_setopt($curl, CURLOPT_ENCODING , "gzip");
  18. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
  19. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
  20. curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
  21. curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
  22. curl_setopt($curl, CURLOPT_PROXY, 'xxx.xx.xx.xx:xx');
  23. curl_setopt($curl, CURLOPT_PROXYUSERPWD, "user:pass");
  24. $post = array('go' => 'add image','file'=>'@1.png');
  25. curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
  26. curl_setopt($curl, CURLOPT_URL, $action);
  27. curl_setopt($curl, CURLOPT_POST,1);
  28. curl_setopt($curl, CURLOPT_POSTFIELDS,  $post);
  29. $out = curl_exec($curl);
  30. echo curl_error($curl);


В ответ упорно выдает ту же страницу с формой заливки файла.

(Отредактировано автором: 23 Июля, 2013 - 22:23:46)

 
 Top
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« Работа с сетью »


Все гости форума могут просматривать этот раздел.
Только зарегистрированные пользователи могут создавать новые темы в этом разделе.
Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
 



Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB