CURL communication protocol

CURL communication protocol

am 20.01.2008 14:11:22 von Paul Lautman

I need to get some data from a MSSQL database via an asp server, to display
in a php generated page. I don't want to pre-format the data from a display
pov, as that means going to the asp server whenever I want to change it.

This data will be a few information fields (e.g. total_number_of_rows_found,
number_of_rows_per_page, current_page_number) plus the columns/rows actually
returned by the query (I guess I really only need to know
total_number_of_rows_found as I will be supplying the other information as
input parms, but this gives the general idea).

I am pleasantly in the exact opposite situation as normally found here, in
that I can control the sending asp script as well as the receiving php one
(although, whilst I may not be anywhere near an expert php programmer, my
php/MySQL skills far outweigh my asp/MSSQL ones!).

An obvious choice of communications protocol is xml, but does anyone have
any other ideas of neat ways to package up the data at the asp end, to make
it easy to access over on the php side?

Re: CURL communication protocol

am 20.01.2008 14:50:00 von Jerry Stuckle

Paul Lautman wrote:
> I need to get some data from a MSSQL database via an asp server, to display
> in a php generated page. I don't want to pre-format the data from a display
> pov, as that means going to the asp server whenever I want to change it.
>
> This data will be a few information fields (e.g. total_number_of_rows_found,
> number_of_rows_per_page, current_page_number) plus the columns/rows actually
> returned by the query (I guess I really only need to know
> total_number_of_rows_found as I will be supplying the other information as
> input parms, but this gives the general idea).
>
> I am pleasantly in the exact opposite situation as normally found here, in
> that I can control the sending asp script as well as the receiving php one
> (although, whilst I may not be anywhere near an expert php programmer, my
> php/MySQL skills far outweigh my asp/MSSQL ones!).
>
> An obvious choice of communications protocol is xml, but does anyone have
> any other ideas of neat ways to package up the data at the asp end, to make
> it easy to access over on the php side?
>
>
>

Paul,

I've found xml is about the best for things like this.

I implemented something similar for a non-profit a while back. Their
local chapters needed access to a subset of the database, but they
didn't want to make the database accessible via the internet. So I just
built some xml2 pages for them to fetch and supplied some cURL code for
them to get what they wanted. The DOM functions in PHP allowed them to
parse the data as they wished.

The only real problem was building "well-formed" xml. I didn't find any
good tools for VBScript for building the xml, but it wasn't all that hard.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: CURL communication protocol

am 20.01.2008 15:15:06 von Paul Lautman

Jerry Stuckle wrote:
> Paul Lautman wrote:
>> I need to get some data from a MSSQL database via an asp server, to
>> display in a php generated page. I don't want to pre-format the data
>> from a display pov, as that means going to the asp server whenever I
>> want to change it.
>> This data will be a few information fields (e.g.
>> total_number_of_rows_found, number_of_rows_per_page,
>> current_page_number) plus the columns/rows actually returned by the
>> query (I guess I really only need to know total_number_of_rows_found
>> as I will be supplying the other information as input parms, but
>> this gives the general idea).
>> I am pleasantly in the exact opposite situation as normally found
>> here, in that I can control the sending asp script as well as the
>> receiving php one (although, whilst I may not be anywhere near an
>> expert php programmer, my php/MySQL skills far outweigh my asp/MSSQL
>> ones!).
>> An obvious choice of communications protocol is xml, but does anyone
>> have any other ideas of neat ways to package up the data at the asp
>> end, to make it easy to access over on the php side?
>>
>>
>>
>
> Paul,
>
> I've found xml is about the best for things like this.
>
> I implemented something similar for a non-profit a while back. Their
> local chapters needed access to a subset of the database, but they
> didn't want to make the database accessible via the internet. So I
> just built some xml2 pages for them to fetch and supplied some cURL
> code for them to get what they wanted. The DOM functions in PHP
> allowed them to parse the data as they wished.
>
> The only real problem was building "well-formed" xml. I didn't find
> any good tools for VBScript for building the xml, but it wasn't all
> that hard.

Good old Microsoft (one doesn't often have a reason to say that!) has got
the best summary of that that I have found:
http://support.microsoft.com/kb/281099

I was sort of wondering about a JSON style protocol, only in php speak,
except that that would I guess entail an eval(), which maybe isn't the best
approach.

Re: CURL communication protocol

am 20.01.2008 15:20:05 von Jerry Stuckle

Paul Lautman wrote:
> Jerry Stuckle wrote:
>> Paul Lautman wrote:
>>> I need to get some data from a MSSQL database via an asp server, to
>>> display in a php generated page. I don't want to pre-format the data
>>> from a display pov, as that means going to the asp server whenever I
>>> want to change it.
>>> This data will be a few information fields (e.g.
>>> total_number_of_rows_found, number_of_rows_per_page,
>>> current_page_number) plus the columns/rows actually returned by the
>>> query (I guess I really only need to know total_number_of_rows_found
>>> as I will be supplying the other information as input parms, but
>>> this gives the general idea).
>>> I am pleasantly in the exact opposite situation as normally found
>>> here, in that I can control the sending asp script as well as the
>>> receiving php one (although, whilst I may not be anywhere near an
>>> expert php programmer, my php/MySQL skills far outweigh my asp/MSSQL
>>> ones!).
>>> An obvious choice of communications protocol is xml, but does anyone
>>> have any other ideas of neat ways to package up the data at the asp
>>> end, to make it easy to access over on the php side?
>>>
>>>
>>>
>> Paul,
>>
>> I've found xml is about the best for things like this.
>>
>> I implemented something similar for a non-profit a while back. Their
>> local chapters needed access to a subset of the database, but they
>> didn't want to make the database accessible via the internet. So I
>> just built some xml2 pages for them to fetch and supplied some cURL
>> code for them to get what they wanted. The DOM functions in PHP
>> allowed them to parse the data as they wished.
>>
>> The only real problem was building "well-formed" xml. I didn't find
>> any good tools for VBScript for building the xml, but it wasn't all
>> that hard.
>
> Good old Microsoft (one doesn't often have a reason to say that!) has got
> the best summary of that that I have found:
> http://support.microsoft.com/kb/281099
>
> I was sort of wondering about a JSON style protocol, only in php speak,
> except that that would I guess entail an eval(), which maybe isn't the best
> approach.
>
>
>

No, I looked into json and decided it wasn't as good - at least for my
project.

The other option I considered was a CSV file. It would have worked for
the time being as all of the data was related - and could easily be
expressed in a spreadsheet, for instance.

But I was afraid perhaps later they would want other data. The xml is
more flexible and would allow that.

And thanks for the link - it's very similar to what I did. I've
actually done a fair amount of VBScript code (although I'm no where near
an expert), so it wasn't hard.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: CURL communication protocol

am 20.01.2008 21:21:59 von Paul Lautman

Jerry Stuckle wrote:
> No, I looked into json and decided it wasn't as good - at least for my
> project.
>
> The other option I considered was a CSV file. It would have worked
> for the time being as all of the data was related - and could easily
> be expressed in a spreadsheet, for instance.
>
> But I was afraid perhaps later they would want other data. The xml is
> more flexible and would allow that.
>
> And thanks for the link - it's very similar to what I did. I've
> actually done a fair amount of VBScript code (although I'm no where
> near an expert), so it wasn't hard.

Did you ever try the aspxml object
(http://www.example-code.com/asp/xmlCreate.asp and
http://www.xml-training-guide.com/a-xml-articles23.html) or the ADODB.Stream
method (http://www.xoc.net/works/tips/getxml.asp). MS doesn't seem to even
mention the former on their site.