bborner
asked on
GET external data using PHP
I need to access data from an external website for display on a FreeBsd server ..
I was given the following code as an example ... but how is this embedded in a PHP procedure?
Example:
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /ws/q88ws.asmx/GetFleetLis t_XmlStrin g?Authoriz ationStrin g=string&F leetName=s tring HTTP/1.1
Host: www.q88.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0"?>
xml
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /ws/q88ws.asmx/GetFleetLis t_XmlStrin g HTTP/1.1
Host: www.q88.com
Content-Type: application/x-www-form-url encoded
Content-Length: length
AuthorizationString=string &FleetName =string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0"?>
xml
Thanks
I was given the following code as an example ... but how is this embedded in a PHP procedure?
Example:
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /ws/q88ws.asmx/GetFleetLis
Host: www.q88.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0"?>
xml
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /ws/q88ws.asmx/GetFleetLis
Host: www.q88.com
Content-Type: application/x-www-form-url
Content-Length: length
AuthorizationString=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0"?>
xml
Thanks
from an external source*
ASKER
Not sure what I get when this is returned nor the syntax to use to perform the get defined below.
The URL you gave me http://www.php.net/file was helpful but still don't know which function to use.
I used a simple: $lines = file("http://www.q88.com/WS/Q88WS.asmx/GetQ88?AuthorizationString=" + "XXXXXXX" + "&VesselName=" + "Chembulk Westport");
This request failed possibly due to the syntax used above to insert the authorization string and vessel name .. (i can't include the actual authorization string for security reasons)
This was btw the Soap 1.2 code given by the provider (Q88) as an example for accessing their data.
POST /ws/q88ws.asmx HTTP/1.1
Host: www.q88.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetFleetList_XmlString xmlns="http://q88.com/webservices/">
<AuthorizationString>strin g</Authori zationStri ng>
<FleetName>string</FleetNa me>
</GetFleetList_XmlString>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetFleetList_XmlStringRes ponse xmlns="http://q88.com/webservices/">
<GetFleetList_XmlStringRes ult>xml</G etFleetLis t_XmlStrin gResult>
</GetFleetList_XmlStringRe sponse>
</soap12:Body>
</soap12:Envelope>
The URL you gave me http://www.php.net/file was helpful but still don't know which function to use.
I used a simple: $lines = file("http://www.q88.com/WS/Q88WS.asmx/GetQ88?AuthorizationString=" + "XXXXXXX" + "&VesselName=" + "Chembulk Westport");
This request failed possibly due to the syntax used above to insert the authorization string and vessel name .. (i can't include the actual authorization string for security reasons)
This was btw the Soap 1.2 code given by the provider (Q88) as an example for accessing their data.
POST /ws/q88ws.asmx HTTP/1.1
Host: www.q88.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetFleetList_XmlString xmlns="http://q88.com/webservices/">
<AuthorizationString>strin
<FleetName>string</FleetNa
</GetFleetList_XmlString>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetFleetList_XmlStringRes
<GetFleetList_XmlStringRes
</GetFleetList_XmlStringRe
</soap12:Body>
</soap12:Envelope>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the PHP function file to get data from an source
http://www.php.net/file
There are plenty of examples there.