2011-08-11 8 views
0

나는 PHP,이 같은 라인을 만들려고 해요 :어떻게 curl_init를 변수로 설정할 수 있습니까?

$cURL = $curl_init('http://mysite.com/2'); 

내가이 그래서 $ 컬에 대한 옵션을 설정할 수 있습니다하고 있어요 ...

curl_setopt($cURL, CURLOPT_PROXY, $proxy); // proxy 
curl_setopt($cURL, CURLOPT_PROXYPORT, $port); // proxy port 
curl_setopt($cURL, CURLOPT_HTTPAUTH, CURLAUTH_ANY); // use authentication 
curl_setopt($cURL, CURLOPT_HTTPHEADER, $headers); // send the headers 
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1); // We need to fetch something from a string, so no direct output! 
curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, 1); // we get redirected, so follow 
curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($cURL, CURLOPT_SSL_VERIFYHOST, 1); 
curl_setopt($cURL, CURLOPT_UNRESTRICTED_AUTH, 1); // always stay authorised 
$wrong = curl_exec($cURL); // Get it 
curl_close($cURL); // Close the curl stream 

수 없어 나는 $ cURL을 설정하고 (그 라인에 오류를 준다), 그 주위에 어떤 방법이 있는가?

답변

3

이 curl_init 전에 $를 사용하지 마십시오 :

$cURL = curl_init('http://mysite.com/2'); 
+0

가 근무, 감사합니다! 가 - 나는 바보처럼 느껴져. xD – Alper

관련 문제