EB023 sending GET request

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
lawliet
Posts: 3
Joined: Thu Oct 08, 2015 1:19 pm
Contact:

EB023 sending GET request

Post by lawliet »

HALO GUYS
I'm trying to load a webpage from a EB-023-00-2 card controlled by a PIC16F877A
I'm using Flowcode V6. I tried in so many way but still doesn't work. I should load the page "/add.php?intru=2" on 10.65.225.104
Could you please help me ? Thanks.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: EB023 sending GET request

Post by LeighM »

Hi
I'm not sure from your comment if you are using the EB-023-00-2 card controlled by a PIC16F877A as a web page server,
or if you are using it as a client to GET a page from another server?


Have you looked at some of our examples, such as the WiKi ...
http://www.matrixtsl.com/wiki/index.php ... tion_Guide

It would help if you could you post your Flowcode file?

lawliet
Posts: 3
Joined: Thu Oct 08, 2015 1:19 pm
Contact:

Re: EB023 sending GET request

Post by lawliet »

Hello LeighM,
Basically what i want to achieve is to get the EB023002 Card to load the "/add.php?intru=2" page hosted on an external server,
that page is so that it adds a line too the Index page of the server, saying there has been a break in on the alarm system.
For the files, i just messed around with the TCP/IP component so I won't bother posting it.
Hopefully you can help me, thanks, Lawliet.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: EB023 sending GET request

Post by LeighM »

Setup your TCP/IP component properties (local IP, MAC, Gateway etc)

Call CreateTCPSocket macro to create the local socket,
then call TCPConnect macro with the remote IP and Port
use TxSendByte to put your request string into the send buffer (i.e. "GET /add.php?intru=2 HTTP/1.0\r\n\r\n")
call TxEnd to send the data to the remote server

Use RxDataAvailable macro to test for the reply, call that in a loop with delay and timeout,
if it returns non-zero then use RxReadByte to get the reply.

You can use GetSocketStatus macro to test for the socket status

Finally close the link with TCPClose

Hope that helps
Leigh

lawliet
Posts: 3
Joined: Thu Oct 08, 2015 1:19 pm
Contact:

Re: EB023 sending GET request

Post by lawliet »

Image
This is what i did and it still doesn't work, first, i can't use TxSendByte because i don't send a octet.
Anyway i tried with TxSendString, no success.
What's wrong with my Flowcode ?

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: EB023 sending GET request

Post by LeighM »

Check your server socket details in TCPConnect(), most HTTP servers run on port 80, so Hi=0, Lo=80.
It might be worth testing the retval after TCPConnect() to check that the connection has been successful.
The GET request needs terminating with CR/LF (twice as I recall), so you need to add TxSendByte(13) and (10)
Also, after TxEnd it is best to wait for the reply, before closing the socket.

Do you have a display attached to your project?
It would help you to put the return values from the macros onto the display.

bats23
Posts: 1
Joined: Sat Oct 24, 2015 9:55 am
Contact:

Re: EB023

Post by bats23 »

I work with ECIO 40 and E023 (ENC28J60), when i try to create the hex file,with flocode 6, there is a trouble.
The message is:
Ping0ECIO4.c(124): error: total number of array elements can not exceed 0x100 (use -idx 2 compiler command line argument to remove this restriction)
...
How to procede ?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: EB023 sending GET request

Post by kersing »

You need to reduce the size of the buffers/arrays to < 256 bytes.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply