1

I want to connect to my one.com webhost, by using my C# winforms application. The support said extern connections is NOT allowed, then how am I gonna read the database table on my webhost? I was told that if I used PHP on the website, then it would work, and it does. But how should i access that code from my program and make it return some values?

Any help will be appreciated. thanks in advance.

PS. If i'm unclear somewhere, or if you need more information then just explain what's needed.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
MasterXD
  • 804
  • 1
  • 11
  • 18

1 Answers1

3

Your webhost has probably restricted the access to your database so that only a specific host can connect to it, namely the one hosting your PHP based website. This is a common practice.

If this is the case, you cannot connect from any other host - and thus, your C# winforms app won't be able to connect either.

So a direct connection from your C# app to your database isn't an option, but you might implement a REST interface with PHP that serves the data you need to the outside world. This could then be accessed by the clients using your C# app. This is the only solution I can think of.

ciruvan
  • 5,143
  • 1
  • 26
  • 32
  • Interesting... How would i do that? And what is REST interface? – MasterXD Aug 29 '13 at 10:13
  • There are a billion ways of implementing a REST interface. Many PHP frameworks facilitate the task. Have a look at [this](http://stackoverflow.com/questions/4684075/how-to-build-a-restful-api) for some useful tips. Also, see [this](http://en.wikipedia.org/wiki/Web_API). – ciruvan Aug 29 '13 at 10:16
  • Thx :D. i'll be looking at this after classes (school whatever :D) – MasterXD Aug 29 '13 at 10:26