CURL HTTPS GET POST отправка

Функции для отправки GET и POST запросов через https

Отправка GET

function send_get($get_url,$coo,$refer)
{
// $get_url — куда отправить ,$coo- строка куков,$refer — якобы откуда пришли, некоторые проверяют
$ch = curl_init();
// curl_setopt($ch, CURLOPT_PROXY, «http://192.168.2.600:2323″);
curl_setopt($ch, CURLOPT_URL, $get_url);
curl_setopt($ch, CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_REFERER, $refer );
curl_setopt($ch, CURLOPT_COOKIE,$coo);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, «Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)»);
curl_setopt($ch, CURLOPT_VERBOSE,1);
return $data = curl_exec($ch);
$type=curl_multi_getcontent($ch);
}

Отправка POST

function send_post($post_url,$post_data,$coo,$refer)
{
// $post_data — PAST которые нужно отправить
// $get_url — куда отправить ,$coo- строка куков,$refer — якобы откуда пришли, некоторые проверяют
$ch = curl_init();
//curl_setopt($ch, CURLOPT_PROXY, «http://192.168.2.600:2323″);
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_REFERER, $refer );
curl_setopt($ch, CURLOPT_COOKIE,$coo);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, «Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)»);
curl_setopt($ch, CURLOPT_VERBOSE,1);
echo $data = curl_exec($ch);
$type=curl_multi_getcontent($ch);
$coo=filter3($type);
curl_close($ch);
return $type;
}

  • file_get_contents POST отправляем -> получаем
  • Динамический base_url в CodeIgniter
  • WordPress получить страницу или пост по его slug
  • Установить elasticsearch На Ubuntu
  • Поиск уязвимостей в PHP-движках
  • url в тексте заменяем ссылками
  • CURL справка
  • Google Analytics в режиме Secure (SSL)
  • Получение первой картинки из поста в WordPress
  • jQuery ajax в IE7
  • CURL получаем / отдаем заголовки
  • php codeigniter отправка писем кириллицей
  • 1 комментарий на “CURL HTTPS GET POST отправка”

    1. Александр:

      В функции «send_post» фатальная ошибка: функция filter3 в строке «$coo=filter3($type);» не определена. Но без нее работает :)
      Строка ошибки php:
      Fatal error: Call to undefined function filter3() in *** on line 21

    Оставить комментарий