Re: Returning a recordset to a desktop app

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/7/2011 7:19 AM, Richard Quadling wrote:
> On 5 March 2011 13:48, Ken Watkins <kwat@xxxxxxxxxxxxxx> wrote:
>> On 3/5/2011 4:30 AM, Richard Quadling wrote:
>>> On 4 March 2011 23:48, Ken Watkins <kwat@xxxxxxxxxxxxxx> wrote:
>>>> Hi All.
>>>>
>>>> I have a Windows desktop app that I created using Visual Foxpro (a database app).
>>>> I want to write a PHP script that I will call from my desktop app. The script will simply
>>>> query a MySQL database on my web server and return the recordset to the desktop app.
>>>>
>>>> My question is simply this: What is the preferred method for passing this recordset back
>>>> to the desktop app? I'm assuming that there's no reasonable way to send a recordset back
>>>> without converting it to an array or XML or an object or something? How do I return the
>>>> data in the recordset to the desktop app?
>>>>
>>>> Thanks for your advice.
>>>> Ken Watkins
>>> In general terms, the output of a PHP script is going to be text
>>> (html, xml, csv, etc.) or binary (images).
>>>
>>> Getting a PHP script to communicate natively with FoxPro is not going
>>> to be trivial task. It MAY be able to be done, but hopefully FoxPro
>>> has the capability of running a PHP script via the command line ...
>>>
>>> C:\PHP5\php.exe -f script.php -- script_arg1 script_arg2
>>>
>>> PHP can either output the result set (in an appropriate form) directly
>>> and FoxPro could read it from STDIN (if it has that support) or PHP
>>> can write the answer to a file and FoxPro can use normal file and
>>> string functions to read the data.
>>>
>>> If FoxPro has XML support, then use it. It will be much cleaner in the
>>> long run if the data changes. If not, then a tab separated data file
>>> (rather than a CSV file). This assumes that your data does not contain
>>> tabs. If so, choose another separator.
>>>
>>> Richard.
>> Richard,
>>
>> Foxpro does have XML support, so you answered that part of my question, thanks.
>> And it is capable of calling any other executable on the local machine through the
>> local OS shell - which seems to be what you are advocating. But I'm not sure how
>> I would do that over the internet. I just discussed this issue with Larry, and I assume
>> that I would use HTTP? Or is there a way to call a command line script on a remote
>> web server without using HTTP?  Sorry if this is a stupid question.
>>
>> Thanks for your help!
>> Ken
> So, what you need to have is an HTTP Request from within FoxPro.
>
> http://www.example-code.com/foxpro/http_post_form.asp
>
> gives an example, but it seems to use a third party ActiveX component.
>
> If FoxPro can load any locally resident/installed ActiveX component,
> then maybe ...
>
> http://fox.wikis.com/wc.dll?Wiki~ReadUrl
>
> has better examples.
>
>
> So, using something from that to get the data (XML) and then using
> FoxPro's native support for XML and you should be on your way.
>
> But at this stage, I'd be looking to ask for further help in a FoxPro
> forum as this is really nothing to do with PHP.
>
> Good luck.
>
> Richard.
Richard,

Thanks for your comments. I ended up taking the simple approach - I installed an ODBC driver for MySQL and let Foxpro query the database directly from a remote workstation. I suppose that what I wanted to do originally was to introduce PHP into the mix just to have another option, and to gain more experience in PHP. Probably not a good idea anyway.

Thanks again for the help.
Ken Watkins

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux