For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > October 2005 > Getting around a restricted connection from an external computer









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Getting around a restricted connection from an external computer
Ian Davies

2005-10-27, 7:57 am

Hello Stefan or anyone else who can help

Some time ago you suggested a solution to my original post about connecting
to data on a remote server from a VB application where my host doesnt allow
a direct external contact. Your solution is below. However my host doesnt
support ASP on the Linux server my site is on. My question is do you know
how to acheive the same thing with php?

Ian


>Hello
>My host does not allow external connections to my MySQL database on their
>server from a remote computer. I would like users of my VB application to

be
>able to add records from a table on said database to their local MySQL
>database. Can anyone advise me of my options to solve this one (appart from
>changing host)?
>
>Thanks
>Ian


Create an ASP that queries the database and saves the recordset to the
response
object. This method assumes the information is encrypted in the db if it's
sensitive.


ASP:
<%Option Explicit%>

<!--#include file="inc/asp_head.asp" -->
<!--#include file="inc/asp_connect.asp" -->
<%Dim rs: Set rs = cn.Execute("get_OnlineEntries " &
LikePhrase(ValidateInputString(Request.QueryString("ShowTitle"),"")) & "," &
LikePhrase(ValidateInputString(Request.QueryString("ShowDates"),"")))
rs.Save Response: rs.Close: Set rs = Nothing: cn.Close: Set cn = Nothing%>

VB app:

Public Function GetOnlineEntries(ByRef sURL As String) As Variant

Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset: rs.Open sURL
If (Not rs.EOF) Then GetOnlineEntries = rs.GetRows: If (Not rs Is Nothing)
Then rs.Close

End Function

mURL = "http://" & frmMain.IP_Main & "/getonlineentries.asp?ShowTitle=" &
URLEncode(frmMain.ShowTitle) & "&ShowDates=" & URLEncode(frmMain.ShowDates)
Dim moe: moe = GetOnlineEntries(mURL)
mbOnlineEntries = IsArray(moe)



Stefan Berglund

2005-10-27, 6:58 pm

On Thu, 27 Oct 2005 12:29:10 GMT, "Ian Davies" <iandan.dav@virgin.net> wrote:
in <qK38f.11737$Ce5.6862@newsfe1-gui.ntli.net>

>Hello Stefan or anyone else who can help
>
>Some time ago you suggested a solution to my original post about connecting
>to data on a remote server from a VB application where my host doesnt allow
>a direct external contact. Your solution is below. However my host doesnt
>support ASP on the Linux server my site is on. My question is do you know
>how to acheive the same thing with php?
>
>Ian


Hi Ian-

Sorry, I can translate from PHP to ASP but since I don't currently have a Linux
box to test on there's not much I can do to help you. Ask in a PHP forum how to
save a recordset to the response object.

---
Stefan Berglund
steve

2005-10-28, 6:57 pm

| Hi Ian-
|
| Sorry, I can translate from PHP to ASP but since I don't currently have a
Linux
| box to test on there's not much I can do to help you. Ask in a PHP forum
how to
| save a recordset to the response object.
|
| ---
| Stefan Berglund

hey stefan! it's good to see you're still alive and posting vb goodies.

btw, the op not only posted to a php ng but also to every computer related
ng i can think of. ;^)

anyway...from an architectural standpoint when working cross-platform, i'd
recommend using web services to make the data consumable...be it from a
php/asp script, gui app, or a proc run on a cron. at that point, each has
enough information to get/publish/consume the data in a manner appropriate
to its given environment (including language)...and without a bunch of
system-specific caveats along the way.

of course i do have other suggestions...but a direct translation is not one
i'm going to afford now.

hth,

me


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com