Solved

How to receive a http post from remote server

Posted on 2008-06-26
4
926 Views
Last Modified: 2013-11-26
Can someone put me on the right path trying to understand what needs to be done to receive a http request from a 3rd party?

My information provider says :
"We will post to you as each message comes in to a URL such as:
http://www.yourserver.com/
receivesms.php?to=TO
&from=FROM&msg=MSG
&date=DATE"

But I want to know how to read this information so that I can add it to a database or dsplay on screen.


0
Comment
Question by:JOHNFROG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:-Thespian-
ID: 21879621
u need a php hosting on http://yourserver.com/
there u need to have a receivesms.php file with the contens of gathering data and putting it to DB.
if 3rd party company can post data to other url, u need to create page by that url.
for example in php that would be (but it is not safe. it is only example):

<?
$link = mysql_connect('<server>', '<username>', '<password>');
if (!$link) {
  die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db(<database>);
mysql_query("INSTERT INTO `<table>` (`to`, `from`, `message`, `date`) VALUES ('{$_GET['to']}', '{$_GET['from']}', '{$_GET['message']}', 'date')");
?>

Open in new window

0
 

Author Comment

by:JOHNFROG
ID: 21879835
Ok but I'm afraid I am more confused now. I think the example given from the provider is aimed at php developer. I am using ASP.NET so sorry for the confusion.

Just need some clues on where to start. Do I need to create a web service?  If the information is sent to my URL then what do I need to do to process it.
0
 
LVL 5

Accepted Solution

by:
-Thespian- earned 250 total points
ID: 21881430
Than let's say url is "http://www.yourserver.com/receivesms.aspx?to=TO&from=FROM&msg=MSG&date=DATE"
Than u need to create an ASPX page "receivesms.aspx" at the root of the site. with the next contens of "receivesms.aspx.cs" file (have simplified it, due to already u are an ASP.Net developer):


....
protected void Page_OnLoad(...)
{
  string to = Request["to"];
  string from = Request["from"];
  string msg = Request["msg"];
  string date = Request["date"];
 
  DataContext context = new DataContext(connectionString);
  context.ExecuteCommand("INSTERT INTO `<table>` (`to`, `from`, `message`, `date`) VALUES ('"+ to +"', '"+ from +"', '"+msg+"', '"+date+"')");
}
....

Open in new window

0
 

Author Closing Comment

by:JOHNFROG
ID: 31470906
I really think that i understand this now. Thabks very much
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question