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" +

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...