라이브러리

[PHP] SoapClient::__getLastResponseHeaders - 마지막 응답의 SOAP 헤더를 반환합니다.




SoapClient::__getLastResponseHeaders

PHP의 SoapClient 클래스는 SOAP 웹 서비스를 호출할 때 사용할 수 있는 유용한 메소드 중 하나입니다. `__getLastResponseHeaders` 메소드는 마지막으로 호출한 SOAP 웹 서비스의 HTTP 헤더를 반환합니다.

사용 방법


`__getLastResponseHeaders` 메소드는 SoapClient 객체의 메소드 중 하나입니다. 이 메소드를 사용하려면 SoapClient 객체를 생성한 후, `__getLastResponseHeaders` 메소드를 호출하면 됩니다.

예제


#hostingforum.kr
php

// SoapClient 객체 생성

$client = new SoapClient('http://example.com/service?wsdl');



// 마지막으로 호출한 SOAP 웹 서비스의 HTTP 헤더를 가져옵니다.

$headers = $client->__getLastResponseHeaders();



// HTTP 헤더를 출력합니다.

echo $headers;



예제 설명


위의 예제에서는 SoapClient 객체를 생성한 후, `__getLastResponseHeaders` 메소드를 호출하여 마지막으로 호출한 SOAP 웹 서비스의 HTTP 헤더를 가져옵니다. 가져온 HTTP 헤더를 출력합니다.

예제 2


#hostingforum.kr
php

// SoapClient 객체 생성

$client = new SoapClient('http://example.com/service?wsdl');



// 마지막으로 호출한 SOAP 웹 서비스의 HTTP 헤더를 가져옵니다.

$headers = $client->__getLastResponseHeaders();



// HTTP 헤더를 분석하여 특정 헤더의 값을 가져옵니다.

$headersArray = explode("
", $headers);

foreach ($headersArray as $header) {

    list($key, $value) = explode(':', $header);

    if (trim($key) == 'Content-Type') {

        echo "Content-Type: $value
";

    }

}



예제 2 설명


위의 예제에서는 SoapClient 객체를 생성한 후, `__getLastResponseHeaders` 메소드를 호출하여 마지막으로 호출한 SOAP 웹 서비스의 HTTP 헤더를 가져옵니다. 가져온 HTTP 헤더를 분석하여 `Content-Type` 헤더의 값을 가져옵니다.

참고


* SoapClient 클래스의 메소드 목록:
* SoapClient::__getLastResponseHeaders 메소드 설명:
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 251 페이지

검색

게시물 검색