Net Connect API -php [message #179011] |
Mon, 03 September 2012 09:32 |
dev
Messages: 3 Registered: September 2012
Karma: 0
|
Junior Member |
|
|
Hi,
i am trying to connect xxx net connect api for credit profile details. i am developing this application in php. But i am getting "HTTP/1.1 303 See Other" Error.
Following is the curl code m executing,
<?php
$credit_profile = '<?xml version="1.0" encoding="UTF-8"?>
<NetConnectRequest xmlns="http://www.xxx.com/NetConnect" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.com/NetConnect NetConnect.xsd">
<EAI>Y1OJYOYX</EAI>
<DBHost>STAR</DBHost>
<ReferenceId></ReferenceId>
<Request xmlns="http://www.xxx.com/WebDelivery" version="1.0">
<Products>
<CreditProfile>
<Subscriber>
<Preamble>TBD2</Preamble>
<OpInitials>TN</OpInitials>
<SubCode>2958499</SubCode>
</Subscriber>
<PrimaryApplicant>
<Name>
<Surname>Adams</Surname>
<First>Nora</First>
<Middle>D</Middle>
</Name>
<SSN>666868483</SSN>
<CurrentAddress>
<Street>704 Xypress St Apt C</Street>
<City>Newburgh</City>
<State>IN</State>
<Zip>97631</Zip>
</CurrentAddress>
<OutputType>
<XML>
<ARFVersion>07</ARFVersion>
<Demographics>Y</Demographics>
<Segment130>Y</Segment130>
<ScorePercentile>Y</ScorePercentile>
</XML>
</OutputType>
<Vendor>
<VendorNumber>FW2</VendorNumber>
</Vendor>
</CreditProfile>
</Products>
</Request>
</NetConnectRequest>';
$post_data = array('NETCONNECT_TRANSACTION'=> urlencode($credit_profile));
$username = 'API Username'; //
$password = 'API Password'; //
$user_pwd = base64_encode($username.':'.$password);
//#2-Net Connect client receives ECALS response. This is the Net Connect URL.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ' http://www.xxx.com/lookupServlet1?lookupServiceName=AccessPoint&lo okupServiceVersion=1.0&serviceName=NetConnectDemo&serviceVersion=2. 0&responseType=text/plain');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$ecals_url = curl_exec($ch);
$info1 = curl_getinfo($ch);
curl_close($ch);
//#3-Net Connect client validates that the URL ends with ".xxx.com". If the URL is valid, the processing continues; otherwise, processing ends.
$host_name = parse_url( $ecals_url );
$host_name = explode(".", $host_name['host'] );
$host_name = $host_name[1].'.'.$host_name[2];
$ecals_url = trim($ecals_url);
if( $host_name == "xxx.com" )
{
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch1, CURLOPT_PORT, 443);
curl_setopt($ch1, CURLOPT_URL,$ecals_url);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch1, CURLOPT_TIMEOUT, 10000); //times out after 10s
curl_setopt($ch1, CURLE_SSL_CONNECT_ERROR, 1);
curl_setopt($ch1, CURLOPT_HEADER, 1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch1, CURLOPT_POST,1);
curl_setopt($ch1, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch1, CURLOPT_USERPWD,$user_pwd);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded',"Content-length: ".strlen($credit_profile) ));
$result2 = curl_exec ($ch1);
$info = curl_getinfo($ch1);
if ( curl_errno($ch1) ) {
$result = 'ERROR -> ' . curl_errno($ch1) . ': ' . curl_error($ch1);
}
else {
$returnCode = (int)curl_getinfo($ch1, CURLINFO_HTTP_CODE);
switch($returnCode){
case 200:
$result = 'ReponseCode ' . $returnCode;
break;
case 302:
$result = 'ReponseCode ' . $returnCode;
break;
case 404:
$result = 'ReponseCode ' . $returnCode;
break;
default:
$result = 'HTTP ERROR -> ' . $returnCode;
break;
}
}
echo curl_error($ch1);
curl_close($ch1);
} // Ends If
?>
Please Advise.
|
|
|
Re: Net Connect API -php [message #179012 is a reply to message #179011] |
Mon, 03 September 2012 13:07 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 9/3/2012 5:32 AM, vivek wrote:
> Hi,
> i am trying to connect xxx net connect api for credit profile details. i am developing this application in php. But i am getting "HTTP/1.1 303 See Other" Error.
> Following is the curl code m executing,
>
<120+ LOC snipped>
>
> Please Advise.
>
Did you try asking xxx? They know more about their system than
anyone here.
And BTW - 303 is not an error. It's a redirect.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Net Connect API -php [message #179013 is a reply to message #179012] |
Mon, 03 September 2012 13:57 |
dev
Messages: 3 Registered: September 2012
Karma: 0
|
Junior Member |
|
|
On Monday, September 3, 2012 6:37:58 PM UTC+5:30, Jerry Stuckle wrote:
> On 9/3/2012 5:32 AM, vivek wrote:
>
>> Hi,
>
>> i am trying to connect xxx net connect api for credit profile details. i am developing this application in php. But i am getting "HTTP/1.1 303 See Other" Error.
>
>> Following is the curl code m executing,
>
>>
>
> <120+ LOC snipped>
>
>>
>
>> Please Advise.
>
>>
>
>
>
> Did you try asking xxx? They know more about their system than
>
> anyone here.
>
>
>
> And BTW - 303 is not an error. It's a redirect.
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================
Jerry,
Thanks for the reply.
I had already raised this issue to their support, but i didn't got any satisfactory answer. please let me know if any more information at your end.
thanks,
vivek
|
|
|
Re: Net Connect API -php [message #179014 is a reply to message #179013] |
Mon, 03 September 2012 14:35 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 9/3/2012 9:57 AM, vivek wrote:
> On Monday, September 3, 2012 6:37:58 PM UTC+5:30, Jerry Stuckle wrote:
>> On 9/3/2012 5:32 AM, vivek wrote:
>>
>>> Hi,
>>
>>> i am trying to connect xxx net connect api for credit profile details. i am developing this application in php. But i am getting "HTTP/1.1 303 See Other" Error.
>>
>>> Following is the curl code m executing,
>>
>>>
>>
>> <120+ LOC snipped>
>>
>>>
>>
>>> Please Advise.
>>
>>>
>>
>>
>>
>> Did you try asking xxx? They know more about their system than
>>
>> anyone here.
>>
>>
>>
>> And BTW - 303 is not an error. It's a redirect.
>>
>>
>>
>> --
>>
>> ==================
>>
>> Remove the "x" from my email address
>>
>> Jerry Stuckle
>>
>> JDS Computer Training Corp.
>>
>> jstucklex(at)attglobal(dot)net
>>
>> ==================
>
> Jerry,
>
> Thanks for the reply.
> I had already raised this issue to their support, but i didn't got any satisfactory answer. please let me know if any more information at your end.
>
> thanks,
> vivek
>
>
People here are not experts in accessing xxx - in fact I'd be
surprised if anyone here has tried it. And no one is going to go through
120+ LOC for free to try to figure out what is wrong. We are, after
all, all volunteers.
If you can't get help from xxx, I would suggest you hire a
consultant (and no, I'm not interested).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
|