TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
karthika pommudu
NA
321
35k
How to get the xml repsonse here..
Mar 7 2019 3:18 AM
Very urgent ..help to get this response
We are tried the xml api call with curl function,but I Can't get xml repsonse from this & I got a response like sequence format
Code format are:
<?php
$soapUrl
=
"http://locationinfo.addtech.in/LocationInfo.asmx?op=ADDGetLiveData"
;
$soapUser
=
"......."
;
// username
$soapPassword
=
"........"
;
// password
$lIMEI
=
"........."
;
$xml_post_string
= '<?xml version=
"1.0"
encoding=
"utf-8"
?>
<soap:Envelope xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:soap=
"http://schemas.xmlsoap.org/soap/envelope/"
>
<soap:Header>
<Authentication xmlns=
"http://ADDtech.org/"
>
<User>
'.$soapUser.'
</User>
<Password>
'.$soapPassword.'
</Password>
</Authentication>
</soap:Header>
<soap:Body>
<ADDGetLiveData xmlns=
"http://ADDtech.org/"
>
<lIMEI>
'.$lIMEI.'
</lIMEI>
</ADDGetLiveData>
</soap:Body>
</soap:Envelope>';
// data from the form, e.g. some ID number
$headers
=
array
(
"Content-type: text/xml;charset=\"utf-8\""
,
"Accept: text/xml"
,
"Host: locationinfo.addtech.in"
,
"Cache-Control: no-cache"
,
"Pragma: no-cache"
,
"SOAPAction: http://ADDtech.org/ADDGetLiveData"
,
"Content-length: "
.
strlen
(
$xml_post_string
),
);
//SOAPAction: your op URL
$url
=
$soapUrl
;
// PHP cURL for https connection with auth
$ch
= curl_init();
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt(
$ch
, CURLOPT_URL,
$url
);
curl_setopt(
$ch
, CURLOPT_HTTPHEADER,
array
(
'Content-type: text/xml;charset=\"utf-8\"'
));
curl_setopt(
$ch
, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of
// curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt(
$ch
, CURLOPT_TIMEOUT, 10);
curl_setopt(
$ch
, CURLOPT_POST, true);
curl_setopt(
$ch
, CURLOPT_POSTFIELDS,
$xml_post_string
);
// the SOAP request
// converting
// header( 'Content-type: text/xml' );
$response
= curl_exec(
$ch
);
curl_close(
$ch
);
print_r(
$response
);
?>
Now Got a Response like:
8.70418078.01902507/Mar/2019 10:42:16 AM0.00OffGPSNorth100%Strong SignalPower Connected
Actually we want response like :
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
soap:Envelope
xmlns:soap
=
"http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd
=
"http://www.w3.org/2001/XMLSchema"
>
<
soap:Body
>
<
ADDGetLiveDataResponse
xmlns
=
"http://ADDtech.org/"
>
<
ADDGetLiveDataResult
>
<
Latitude
>
11.713210
</
Latitude
>
<
Longitude
>
78.083677
</
Longitude
>
<
PositionTime
>
04/Mar/2019 04:20:46 PM
</
PositionTime
>
<
Speed
>
25.00
</
Speed
>
<
ACC
>
Off
</
ACC
>
<
PositionType
>
GPS
</
PositionType
>
<
Direction
>
NorthWest
</
Direction
>
<
Battery
>
100%
</
Battery
>
<
GSMStrength
>
Strong Signal
</
GSMStrength
>
<
PowerStatus
>
Power Connected
</
PowerStatus
>
</
ADDGetLiveDataResult
>
</
ADDGetLiveDataResponse
>
</
soap:Body
>
</
soap:Envelope
>
Any help is greatly appreciated. Thanks for looking.
Reply
Answers (
2
)
I can not see the contents of the file after downloading?
receive fully string repsonse frm xml api,help to clear tis