interactive-matter / httpclient Goto Github PK
View Code? Open in Web Editor NEWAn Arduino HTTP Client
Home Page: https://interactive-matter.eu/how-to/arduino-http-client-library/
An Arduino HTTP Client
Home Page: https://interactive-matter.eu/how-to/arduino-http-client-library/
If I put the next line: client.closeStream(result);, the "setup" function is executed many times!... and when I don't close the stream (I mean, when I don't put that piece of code), setup goes fine... but a few minutes more, I cannot connect with the server.
here is my code:
FILE* result = client.postURI(uri, NULL, data, header );
//int returnCode = client.getLastReturnCode();
if (result != NULL) {
client.closeStream(result); // <--- that line is the problem.
Serial.println("sent");
}
that code is in the loop function.
Hope can help me
Hi, i want to use your library but it just cant be compile or verified, I have added the library through sketch->add .zip and it is well under C:\Users\Dan\Documents\Arduino\libraries\HTTPClient-master, and include HTTPClient.h in the code, what could be the problem? am using arduino 1.6.7. I get the error HTTPClient does not name a client.
In my eyes it can be helpful especially for downloading files from HTTP to read "Content-length" out of the Header while skipping it and make it available like the Return Code. So it can be used to check the read content bytes after downloading it
Hi,
I was wondering why the headers were skipped correctly for the very first getURL call, but for all subsequent calls only the "HTTP/1.1 $Statucode" part is removed.
After searching a long time I found the problem:
In "skipHeaders" the both variables inByte und lastByte are declared "static" and first set to 0.
Then it is checked that both variables are not "/n" together.
This is the case for the first run (because they are initialized as 0.
So it works for the first URI.
For the second URI the values are preserved and so are both "/n" initially, so the while loop is never entered ... because of this no header is removed from all subsequent URIs ...
When removing the "static" everything works much better :-)
if I uncomment the section that reads the servers response, it crashes the Arduino Mega 2560. I'd really like to be able to read the page returned by the server.
my code:
HTTPClient hclient(serverName,(uint8_t )uint8_serverIP);
f1=hclient.postURI(urlbuf, NULL, databuf, headers );
/
char cc;
while((cc = fgetc(f1)) != EOF)
{
Serial.print(cc);
}
*/
int retcode=hclient.getLastReturnCode();
Hi,
this library is specific for EthernetClient. In another fork someone adopted it to WifiClient and there is a other issue here to support GSMClient.
I also need Ethernet für one project and Wifi for another and so I would wish myself more flexibility
So my idea would be to change the design of the class and have the option to set the used "Client" in constructor. Therefor it would be needed to remove the interitance from EthernetClient and replace by a member variable for the used client instance.
Is there any real reason why it is interited at the moment?
Would this be something you would be interested in to work on or should I do it as my own fork?
Also, I seem to be getting some very strange numbers from getLastReturnCode(). The debugging prints show status 200, but getLastReturnCode is giving me varying numbers, even negative numbers:
1300
513
2
512
-236
1024
etc.. There seems to be no fixed pattern
Hi
I’ve tried this code inside loop() and it is called very 10s:
if ( tenSecs ) {
FILE* result = client.getURI(“/test/P.php”,get_parms);
if (result!=NULL) {
int returnCode = client.getLastReturnCode();
if (returnCode==200) {
Serial.println(“loop::data uploaded”);
}
else {
Serial.print(“ERROR: Server returned “);
Serial.println(returnCode);
}
client.closeStream(result);
}
else {
Serial.println(“ERROR::failed to connect”);
}
}
Only the first GET works. All others fail – any idea?
I've tried using fgets, fscanf, etc... and I am unable to read the result stream from a postURI call that is successful and should (does) have data returned from the API. If you have any information or examples on how to read this stream they would be much appreciated.
Thanks,
Jason
@interactive-matter @Apollon77
how to do that?
Please help me..
Hi --
First, really like your your work -- especially the light triangles.
It seems that Arduino 1 and this library are incompatible. Are you working on a fix?
is it possible to port this library to use GSM shield instead Ethernet?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.