php 卷曲php转义查询中的特殊字符
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 卷曲php转义查询中的特殊字符相关的知识,希望对你有一定的参考价值。
public function curlSetOptions($url, $proxy, $connectionTimeout, $timeout, $postFields = null)
{
$get_init = explode('//',$url); // get only HTTPS or HTTP from URL
$url = str_replace('https://', '' , $url); // remove this part from URL
$url = str_replace('http://', '' , $url); // case if HTTP only, remove too
$url = urlencode($url);
$url = $get_init[0].'//'.str_replace("%2F","/", $url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (isset($postFields)) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
}
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connectionTimeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
return $ch;
}
以上是关于php 卷曲php转义查询中的特殊字符的主要内容,如果未能解决你的问题,请参考以下文章
php正则表达式转义特殊字符[重复]
从php中的字符串中转义特殊字符
php防止sql注入
处理大卷曲响应 - PHP
特殊字符-php
addslashes,htmlspecialchars,htmlentities转换或者转义php特殊字符防止xss攻击以及sql注入