Skip to main content
Published: March 04 2010, 11:53:00 PMUpdated: November 28 2020, 8:11:15 PM

Illustrates how to make OpeneBayIdentityProviderService.login request of type XML 

Detailed Description

   This is a simple sample that shows how to use PHP to make OpeneBayIdentityProviderService.login API call to obtain EIDP token that is a required HTTP header for Open eBay Application Integration Service API calls.

   Prerequisites You must have successfully deployed an Open eBay Apps application into either Sandbox or Production environment and obtained your Open eBay application key set as described in Open eBay App users guide..


    $endpoint = '';     // URL to call
    $OPERATION= "login";
    $APPID= "";                                                               //INSERT YOUR AppID HERE
    $DEVID= "";                                                              //INSERT YOUR DevID HERE
    $CERT= ""                                                                 //INSERT YOUR Cert HERE
    // specify required HTTP Headers
    $headers = array(
       'X-EBAY-SOA-SERVICE-NAME: OpeneBayIdentityProviderService',
       'CONTENT-TYPE: text/xml',
    // build OpeneBayIdentityProviderService.login API request payload
    $xmlRequest  = '<?xml version="1.0" encoding="utf-8"?>';
    $xmlRequest .= '<loginRequest xmlns="">';
    $xmlRequest .= '<attributes>';
    $xmlRequest .= '<attribute name="devId">';
    $xmlRequest .= '<attributeValue>';
    $xmlRequest .= $DEVID;
    $xmlRequest .= '</attributeValue></attribute></attributes>';
    $xmlRequest .= '<credential appId="';
    $xmlRequest .= $APPID;
    $xmlRequest .= '">';
    $xmlRequest .= '<certId>';
    $xmlRequest .= $CERT;
    $xmlRequest .= '</certId></credential></loginRequest>';
    $session  = curl_init($endpoint);                       
    // create a curl session
    curl_setopt($session, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($session, CURLOPT_POST, true);                            // POST request type
    curl_setopt($session, CURLOPT_POSTFIELDS, $xmlRequest);   // set the body 
    curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($session, CURLOPT_HEADER, true);                       // display headers
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);    
    echo "\n";
    echo $xmlRequest;                                                                  // log the request payload
    echo "\n\n";
    $responseXML= curl_exec($session);

    if ($responseXML) {
       echo $responseXML;                                                          // log the response payload




How well did this answer your question?
Answers others found helpful