# $Revision: 1.1.1.3 $ # # $Date: 2003/06/25 17:40:00 $ use strict; use LWP::UserAgent; use HTTP::Request; use HTTP::Headers; my $objUserAgent = LWP::UserAgent->new; my $request = "<?xml version='1.0' encoding='utf-8' ?> <request> <RequestToken>ABC...123</RequestToken> <ErrorLevel>1</ErrorLevel> <DetailLevel>0</DetailLevel> <Verb>GeteBayOfficialTime</Verb> </request>"; my $objHeader = HTTP::Headers->new; $objHeader->push_header('X-EBAY-API-COMPATIBILITY-LEVEL' => '311'); $objHeader->push_header( 'X-EBAY-API-SESSION-CERTIFICATE' => 'rbrown;rbrownapp01;12321AB121A2A1B'); $objHeader->push_header('X-EBAY-API-DEV-NAME' => 'rbrown'); $objHeader->push_header('X-EBAY-API-APP-NAME' => 'rbrownapp01'); $objHeader->push_header('X-EBAY-API-CERT-NAME' => '12321AB121A2A1B'); $objHeader->push_header('X-EBAY-API-CALL-NAME' => 'GeteBayOfficialTime'); $objHeader->push_header('X-EBAY-API-SITEID' => '0'); $objHeader->push_header('X-EBAY-API-DETAIL-LEVEL' => '0'); $objHeader->push_header('Content-Type' => 'text/xml'); $objHeader->push_header('Content-Length' => length($request)); my $objRequest = HTTP::Request->new("POST", 'https://api.sandbox.ebay.com/ws/api.dll', $objHeader, $request); # for https you will need an ssl enabling package # the following line from the PPM directory will install # one such PPM package based on OpenSSL for the ActiveState 5.6 Perl build # PPM> install http://www.activestate.com/PPMPackages/5.6plus/Crypt-SSLeay.ppd my $objResponse = $objUserAgent->request($objRequest); if (!$objResponse->is_error) { # your error handling code here } else { # success, your processing code here }
2007년 3월 6일 화요일
perl HTTP::Request 샘플 ebay.api 예제
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기