Jump to content

Request url from web server


Recommended Posts

OK, I am stuck, and to be honest I have no idea why I am stuck. All I want to do is request a web page from a web server. Specifically, I have created a PHP page that will return the string "OK" when called. I am using this page for the PLC to report that it has an error. Inside the PHP, I will use the parameters to identify the PLC and the error. This should be easy, Right?

I have configured my port and my TCP/IP configuration to socket 3, port 504. I issue a TCP/IP connect to the server (IP is correct, port is 80), and it appears to connect. I then issue a TCP/IP Send to send the GET /url/r/nHost: <hostname>/r/n/r/n/r/n. And that is where I am stuck. It does not appear that the message is sent to the sever. In fact, my web server never "sees" the request.

Does anyone have any idea how to issue a url request to a web server? I do not even care about what I get back, I just want to call the page.
 

Any help is greatly welcome. Thank you in advance.

Tim J.

Link to comment
Share on other sites

OK, I found the solution. You must use TCP_RAW Send and your message must be in a format like:

GET http://localhost:2006/1.aspx HTTP/1.1\r\n" +
                "Host: localhost:2006\r\n" +
                "Connection: keep-alive\r\n" +
                "User-Agent: Mozilla/5.0\r\n" +
                "\r\n";

I did not use the User-Agent stuff, but I still included an empty line. Once I did this, my web server started reporting the GET request.

 

  • Upvote 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.