2012-07-23 6 views
0

그래요. 기본적으로 activecollab 프레임 워크에서 xero에 연결할 응용 프로그램을 빌드하고 있습니다. 그리고 David Pitman이 만든 xeroapi PHP 스크립트를 테스트하고 있습니다. 그리고 난 그냥 여기 XERO-API가 실제 서버에서 작동하지만 테스트 서버에서 작동하지 않습니다.

thumb http://iforce.co.nz/i/iq5bxw0r.5gz.png

코드의 조각입니다 ... 브라우저가 The connection to the server was reset while the page was loading.로 응답 (그러나 어떤 liveheadersfirebug 아무것도 최대를 선택 않습니다 생성하지 않는) 이유를 찾기 위해 노력하고있어 사용 중입니다. 의 error_log (PHP)이 경고에서 오류를 일부를 표시하지 않습니다 ...

define('XERO_KEY','my-key-here'); //hidden for privacy reasons 
    define('XERO_SECRET','my-key-here'); //hidden for privacy reasons 
    define('XERO_PUBLIC_KEY_PATH', 'path/to/public.key'); 
    define('XERO_PRIVATE_KEY_PATH', 'path/to/privatekey.pem'); 

    $xero = new Xero(XERO_KEY, XERO_SECRET, XERO_PUBLIC_KEY_PATH, XERO_PRIVATE_KEY_PATH, 'xml'); 
    $organisation = $xero->organisation; 

    //echo the results back 
    if (is_object($organisation)) { 
    //use this to see the source code if the $format option is "xml" 
    echo htmlentities($organisation->asXML()) . "<hr />"; 
    } else { 
    //use this to see the source code if the $format option is "json" or not specified 
    echo json_encode($organisation) . "<hr />"; 
    } 

(. 모든 XERO의 API 뷰어 및하려면 openssl을 사용하여 이전하고 설정을 가지고) 그리고 내 문제는 다음과 같습니다

2012-07-23 21:59:42 Notice : Undefined index: port (at C:\xampp\htdocs\ac3\activecollab\3.1.10\modules\xero_invoice_manager\lib\xero\xero.class.php on 644 line) 

내가 print_r의 결과에 발견 한 조사에서 xero.class.php 라인 (644)

/** 
* parses the url and rebuilds it to be 
* scheme://host/path 
*/ 
public function get_normalized_http_url() { 
$parts = parse_url($this->http_url); 

$port = @$parts['port']; //this line says its undefined 
$scheme = $parts['scheme']; 
$host = $parts['host']; 
$path = @$parts['path']; 

$port or $port = ($scheme == 'https') ? '443' : '80'; 

if (($scheme == 'https' && $port != '443') 
    || ($scheme == 'http' && $port != '80')) { 
    $host = "$host:$port"; 
} 
return "$scheme://$host$path"; 
} 

의 코드 preformatted tag에서입니다 ..

Array 
(
    [scheme] => https 
    [host] => api.xero.com 
    [path] => /api.xro/2.0/Organisation 
) 

같은 정보는 (지난 두 달간 용) 라이브 서버에 사용됩니다. xeroapi 클래스는 테스트 서버에서 작동하지 않습니다. 연결되지 않은 이유에 대한 조언이있는 사람이 있습니까? 나는 port 80PHP Version 5.3.8에 아파치가있는 XAMPP Control Panel을 실행 중입니다.

답변

1

포트 문제가 확실하지 않습니다.

그러나 Xero API는 OAuth 설정이 필요하며 이는 Xero 클래스에서 수행됩니다. OAuth의 일부는 콜백 도메인을 설정하는 것입니다.이 경우 Xero로 콜백 도메인을 등록해야합니다. Xero를 사용하면 등록 된 도메인의 하위 도메인을 사용할 수 있으며 Xero 클래스가 요청 정보를 사용하여 올바른 도메인을 설정한다고 가정합니다.

localhost에서 해당 도메인은 localhost이며 하위 도메인은 아닙니다. localhost를 등록하거나 응용 프로그램 계정에 대한 액세스 권한이 없기 때문에 수행 한 작업을 수행하고 호스트 파일에 특수 로컬 하위 도메인을 설정할 수 있습니다.

따라서 example.com을 사용하면 좋은 '로컬'도메인은 local.example.com입니다. 희망이 도움이됩니다.

+0

'127.0.0.1 test.mydomain.com'이 아니라 웹 서버의 가상 서버를 사용하여 여러 프로젝트를 관리하는데도 사용합니다. – Aatch

+0

고마워, 많이 .. 나는 대학에서 돌아올 때 이것을 시험해보고 작동한다면 : P 나는 당신의 답을 선택한 것으로 표시 할 것이다 :) (그러나 지금은 +1 담당자) – Killrawr

+0

감사합니다! 당신의 대답에 대한 더 많은 정보를 제공하기 위해 :) – Killrawr

관련 문제