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;
}

Post to Twitter Tweet This Post

  • file_get_contents POST отправляем -> получаем
  • Динамический base_url в CodeIgniter
  • Поиск уязвимостей в PHP-движках
  • CURL справка
  • CURL получаем / отдаем заголовки
  • Получение первой картинки из поста в WordPress
  • jQuery ajax в IE7
  • Google Analytics в режиме Secure (SSL)
  • php codeigniter отправка писем кириллицей
  • отключить автозаполнение форм и полей форм
  • Как восстановить контроль над доменами зарегистрированными в 3fn.net
  • Полезные регулярные выражения которые могут пригодиться
  • Оставить комментарий