-2
저는 Ajax 함수 매개 변수가있는 함수에서 cUrl 요청을 보내려고합니다.ajax 함수 매개 변수가있는 함수에서 cUrl 요청 보내기
이 내 컬 요청입니다 : 내가 아약스에 의해 다른 파일, 기능 변수 $ CHS을 보내 원하는
function cUrlConnection ($url, $username, $password, $ch) {
$pass = md5($password);
$data = array(
'username' => $username,
'password'=> $pass,
);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.4) Gecko/20060426 Firefox/1.5.0.4');
curl_setopt($ch, CURLOPT_TIMEOUT, '40');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
$pos = strpos($result, "התחברת בהצלחה");
if ($pos === false) {
return false;
}
else
{
return $ch;
}
}
$chs = cUrlConnection($url, $username, $password, $ch);
. 나는 이것을 어떻게합니까?
시작 $의 CH = curl_init ($의 URL)에서 사용하십시오; $ ch –
을 초기화하지 않았습니다. 추가되었습니다.하지만 여기서는 숨 깁니다. –