2013-09-07 5 views
0

나는 stackoverflow와 다른 곳에서이 두 가지를 보았습니다.이 오류가 계속 발생할 수 있습니다.정의되지 않은 함수를 호출하십시오. cur_init()

어떤 방법 - 유용한 정보

은 phpinfo를 실행

<?php 

    function getOAuthToken ($grantCode, $grant_type) { 
     global $client_id; 
     global $client_secret; 
     global $refresh_token; 


     try {  
      ini_set('display_errors', '1'); 
      error_reporting(E_ALL); 

      $oauth2token_uri = "https://accounts.google.com/o/oauth2/token"; 
      $clienttoken_post = array(
       "client_id" => $client_id, 
       "client_secret" => $client_secret 
       ); 

      if ($grant_type === "online") { 
       $clienttoken_post["code"] = $grantCode; 
       $clienttoken_post["redirect_uri"] = $refresh_token; 
       $clienttoken_post["grant_type"] = "authorization_code"; 
      } 

      if ($grant_type == "offline") { 
       $clienttoken_post["refresh_token"] = $grantCode; 
       $clienttoken_post["grant_type"] = "refresh_token"; 
      }   

      $curl = cur_init($oauth2token_uri); 

     } 
     catch (Exception $e) 
     { 
      echo 'Message: ' .$e->getMessage(); 
     } 


    }; 

    session_start(); 

    if (isset($_GET['code'])) {  
     try 
     { 

      $accessToken = getOAuthToken($_GET['code'],'online');    

     } 
     catch (Exception $e) 
     { 
      echo 'Message: ' .$e->getMessage(); 
     } 
    } 

?> 

윈도우 7 (64 비트) IIS 익스프레스

php.ini의

을 다음과 같이 내가 실행하려고 코드는()는 다음 정보를 제공합니다.

PHP는 버전 5.3.24

로드 구성 파일 C : \ 프로그램 파일 컬을 지원 컬 정보 7.29.0 3 개 세 특징 AsynchDNS을 활성화

(86) \의 PHP \ php.ini의 예 디버그 없음 GSS-협상 예 IDN 없음 IPv6의 예 큰 파일로 예 NTLM 예 SPNEGO 예 SSL 예,451,515,SSPI 예 krb4 없음 libz 예 CharConv 없음 프로토콜 DICT, 파일, FTP, FTPS, 고퍼, HTTP, HTTPS, IMAP, IMAPS, LDAP, POP3, POP3S, RTSP, SCP, SFTP를, SMTP, SMTPS, 텔넷, TFTP 호스트 I386-PC-는 Win32 SSL 버전은 OpenSSL 1.2.7 libSSH 버전은 다음 코드를 실행/1.4.2

을 libssh2 ZLIB 버전/0.9.8y;

<?php 

[email protected]_version(); $cv=$ci["version_number"]; if($cv) echo "curl 
installed"; else echo "curl is not installed"; 

?> 

는 컬이

를 설치 표시

Libcurl.dll의 Windows \ system32를 C에 설치 (v7.13) : \ WINDOWS \ SysWOW64와

확장 디렉토리가 C로 제공됩니다 : \의 Program Files (x86) 이것은 php.ini 파일 (버전 5.3.24) php_curl.dll

포함 EXT

\ PHP는 \의 V5.3의 \ 라인 파일

012
extension=php_curl.dll 

3,516,는 C로 복사 된 것이

DLL이 ssleay32.dll (0.9.8y 버전)의 전면에는 세미콜론이 없습니다 :

\ WINDOWS \ SysWOW64와 : SYSTEM32 및 C \ \ 창을 DLL libeay32.dll (버전 1.0.1e)이 c : \ windows \ System32 및 c : \ windows \ sysWOW64에 복사되었습니다.

나는 내가 찾은 모든 대답을 다룰 수 있다고 생각하지만, 정의되지 않은 함수 cur_init()를 호출하면 오류가 발생하며 다음에 시도 할 내용이 없습니다.

답변

3

$curl = curl_init($oauth2token_uri); 

하지

$curl = cur_init($oauth2token_uri); 
+0

도현해야합니다! 정의 호머 심슨 순간 - :( 감사합니다 !!! –

+0

하하, 걱정하지 마, 우리 모두는 그 순간을 가지고 :) –

관련 문제