Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 托管认证是如何工作的?_Php_Codeigniter_Curl_Escrow - Fatal编程技术网

Php 托管认证是如何工作的?

Php 托管认证是如何工作的?,php,codeigniter,curl,escrow,Php,Codeigniter,Curl,Escrow,我尝试使用托管REST完整API调用身份验证API。 但是,我没有从身份验证API获得任何有效响应 我已经使用Codeigniter CURL方法发布带有URL的变量 然而,它仍然不为我工作 我得到以下响应:身份验证被拒绝 如果有人想解决这个问题,请帮助我 我使用的代码: //The JSON data. $url = 'https://stgsecureapi.escrow.com/api/Transaction'; $jsonData = array(

我尝试使用托管REST完整API调用身份验证API。 但是,我没有从身份验证API获得任何有效响应

我已经使用Codeigniter CURL方法发布带有URL的变量 然而,它仍然不为我工作

我得到以下响应:身份验证被拒绝

如果有人想解决这个问题,请帮助我

我使用的代码:

    //The JSON data.
    $url = 'https://stgsecureapi.escrow.com/api/Transaction';

    $jsonData = array(
        'username' => '*****@gmail.com',
        'password' => '****',
    'pid' => '***'
    );

    //Encode the array into JSON.
    $jsonDataEncoded = json_encode($jsonData);
    print_r($jsonDataEncoded);
    // Start session (also wipes existing/previous sessions)
    $this->curl->create($url);

    // Option           
    $this->curl->option(CURLOPT_HTTPHEADER, array('Content-type: application/json; Charset=UTF-8'));

    // Post - If you do not use post, it will just run a GET request            
    $this->curl->post($jsonDataEncoded);

    // Execute - returns responce 
    $this->data['curlreturn'] = $this->curl->execute();
    //exit;
    $this->load->view('pay/pay', $this->data);

我通过与XML人口的托管得到了答案

还要检查用于使用CURL调用API的函数

$requeste = '<Transaction xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/DTO">
<Title>XML GM Broker Transaction (REST Service)</Title>
<Description>XML GM Broker Transaction (REST Service)</Description>
<TransactionType>1</TransactionType>
<Partner>PartnerId>1234</PartnerId></Partner><Buyer>
<Email>aniji@gmail.com</Email><Initiator>false</Initiator>
<CompanyChk>false</CompanyChk><AutoAgree>true</AutoAgree>
<AgreementChecked>true<AgreementChecked></Buyer>
<Seller><Email>shaibi@gmail.com</Email><Initiator>false</Initiator>
<CompanyChk>false</CompanyChk><AutoAgree>true<AutoAgree>
<AgreementChecked>true</AgreementChecked></Seller><Broker>
<Email>rahul@gmail.com</Email><Initiator>true</Initiator>
<CompanyChk>true<CompanyChk><AutoAgree>true</AutoAgree>
<AgreementChecked>true</AgreementChecked></Broker>
<LineItems> 
<LineItem>      
 <ItemName>syam Milestone 1<ItemName>       
 <Description>Description of Milestone 1</Description>      
 <Quantity>1</Quantity>     
 <Price>1670</Price>        
 <Accept>true</Accept>  
 <SellComm>100<SellComm>        
 <BuyComm>50</BuyComm>  
</LineItem> 
<LineItem>      
 <ItemName>syam MIlestone 2</ItemName>      
 <Description>Description of MIlestone 2<Description>
 <Quantity>1</Quantity>     
 <Price>1450</Price>        
 <Accept>true</Accept>
 <SellComm>100</SellComm>       
 <BuyComm>50</BuyComm>
<LineItem>
</LineItems>
<EscrowPayment>0</EscrowPayment><ShipmentFee>0</ShipmentFee>
<ShipmentPayment>0</ShipmentPayment>
<InspectionLength>6</InspectionLength><Currency>USD<Currency>
<Fulfillment>1</Fulfillment><Disclosure>1</Disclosure>
<BrokerCommissionPayee>Buyer</BrokerCommissionPayee>
<BrkCommissionBuyerPortion>18.1<BrkCommissionBuyerPortion>
<BrkCommissionSellerPortion>19.1</BrkCommissionSellerPortion>
<CommissionType>1<CommissionType>
<SettlementAuthorizationToken>9ACA7889-8A9A-4288-8E28-C325ACD953DB<SettlementAuthorizationToken><InitiationDate>2015-05-15<InitiationDate<TransactionLocked>true</TransactionLocked<PartnerTransID>4286<PartnerTransID><TermsLocked>true<TermsLocked>
<AllowReject>true</AllowReject> </Transaction>';

print curl_dwonload('https://stgsecureapi.escrow.com/apiTransaction',$xmldataFull);//Function for CURL
function curl_dwonload($Url,$request)
{
 if (!function_exists('curl_init')){
    die('Sorry cURL is not installed!');
}       
    try {
        $url = $Url;
        $ch = curl_init();                                                        
    curl_setopt($ch, CURLOPT_URL, $url);    
    curl_setopt($ch, CURLOPT_POST, true);    
    curl_setopt($ch, CURLOPT_USERPWD, "brokeremail@gmail.com:broker_password");// Must enter username and password
    curl_setopt($ch, CURLOPT_POSTFIELDS,$request);                
    curl_setopt($ch, CURLOPT_HEADER, 1);                       
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
      $header = array();
      $header[]="Content-Type: application/xml";
      $header[] = "POST /transaction HTTP/1.1";                                                                     
      $header[]= "Accept:application/xml";                                   
      $header[] = "Host: api.escrow.com";
      //$header[] = "Authorization: Basic T3BhbmFrOlRlc3QxMjM0";
      $header[] = "Content-Length: ".strlen($request);
      $header[] = "Connection: close";
      curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);     
      //echo $ch;                                            
      $data = curl_exec($ch);       
      return $data;
    }
catch (Exception $e) {
      echo $e->getMessage();
      $responseBody = '';
      return "error";
    }

}
$requeste=”
XML GM代理事务(REST服务)
XML GM代理事务(REST服务)
1.
PartnerId>1234
aniji@gmail.comfalse
假象
真的
shaibi@gmail.comfalse
假象
真的
rahul@gmail.comtrue
真的
真的
syam里程碑1
里程碑1的说明
1.
1670
真的
100
50
syam里程碑2
里程碑2的说明
1.
1450
真的
100
50
00
0
6美元
11
买主
18.1
19.1
1.

9ACA7889-8A9A-4288-8E28-C325ACD953DB2015-05-15是的,他们应该在rest api文档中添加身份验证详细信息。我使用python请求进行授权:

    response = requests.post(url, data=simplejson.dumps(payload), headers=headers,auth=(username,password))
    print "Response: "+str(response)
    print "Response: "+str(response.headers)
    print "Response: "+str(response.content)

我使用了以下json格式的代码

$requeste = '{
"Title": "REST DN test transaction (JSON)",
"Description": "REST DN test transaction (JSON)",
"TransactionType": 0,
"Partner": {
"PartnerId": 1234
},
"Buyer": {
"Email": "escrow.buyer@hotmail.com",
"Initiator": false,
"CompanyChk": false,
"AutoAgree": false,
"AgreementChecked": false
},
"Seller": {
"Email": "escrow.seller@hotmail.com",
"Initiator": true,
"CompanyChk": false,
"AutoAgree": false,
"AgreementChecked": false
},
"LineItems": [
{
"ItemName": "test.com",
"Description": "DN description",
"Quantity": 1,
"Price": 2000,
"Accept": true,
"SellComm": 9.1,
"BuyComm": 10.1,
}],
"EscrowPayment": 0,
"ShipmentFee": 0,
"ShipmentPayment":0,
"DomainNameType": 0,
"InspectionLength": 6,
"Currency": "USD",
"Fulfillment": 2,
"CommissionType": 1,
"InitiationDate": "2014-04-15",
"TermsLocked": true,
"AllowReject": true
}';


print curl_dwonload('https://stgsecureapi.escrow.com/api/Transaction',$requeste);//Function for CURL
function curl_dwonload($Url,$request)
{
 if (!function_exists('curl_init')){
    die('Sorry cURL is not installed!');
}       
    try {
        $url = $Url;
        $ch = curl_init();                                                        
    curl_setopt($ch, CURLOPT_URL, $url);    
    curl_setopt($ch, CURLOPT_POST, true);    
    curl_setopt($ch, CURLOPT_USERPWD, "emailid:password");// Must enter username and password
    curl_setopt($ch, CURLOPT_POSTFIELDS,$request);                
    curl_setopt($ch, CURLOPT_HEADER, 1);                       

      curl_setopt ($ch, CURLOPT_HTTPHEADER,  array('Content-type: application/json; Charset=UTF-8'));     
      //echo $ch;                                            
      $data = curl_exec($ch);       
      echo $data;
    }
catch (Exception $e) {
      echo $e->getMessage();
      $responseBody = '';
      return "error";
    }

}
也可以查看下面的youtube链接


您使用的是SOAP UI吗?不,我使用的是由第三方托管提供的REST集成工具包。似乎是请求元素中的错误。再次验证请求元素。我在这里使用的元素是合作伙伴ID、用户名和密码……您可以发布您的wsdl和请求吗?