Hi,
I an trying to connect an NodeMCU to a website but unfortunately only receiving httpcode 302 from a particular site ,while getting -1 from www.arduino.cc. i am able to fetch results from jsonplaceholder examples.
The same get query gives me response via postman, http code 200. The rest api is public,i.e gives response even without signing in.
According to w3 schools definition, 302 code is temporary,and i need to continue requesting.
How can i overcome this problem? Please help me this is very urgent.
system
April 3, 2018, 11:08pm
2
The HTTP response status code 302 Found is a common way of performing URL redirection.
So, your browser or other software handles the redirection. Your code does not.
The redirect may be temporary, but almost never is. The site has moved. Get over it. The are most likely not moving back.
Juraj
April 4, 2018, 11:36am
3
www.arduino.cc redirects to https. to test http use http://arduino.cc/asciilogo.txt
Hi,
Yes that is true.
Unfortunately my site redirect is https and not http,so when i write the https address it always returns me httpcode -1.
have tried fruitlessly but could not figure out yet.
Juraj
April 4, 2018, 2:13pm
5
you must use the https client of esp8266
Can you please give me a sample code for it?
I am following:
Juraj
April 4, 2018, 2:39pm
7
it is always better to search information at the relevant source, not everywhere on Internet
/*
HTTP over TLS (HTTPS) example sketch
This example demonstrates how to use
WiFiClientSecure class to access HTTPS API.
We fetch and display the status of
esp8266/Arduino project continuous integration
build.
Created by Ivan Grokhotkov, 2015.
This example is in public domain.
*/
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include "certs.h"
#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
This file has been truncated. show original
Juraj:
it is always better to search information at the relevant source, not everywhere on Internet
Arduino/libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino at master · esp8266/Arduino · GitHub
Thank you ill update you soon!
Juraj:
it is always better to search information at the relevant source, not everywhere on Internet
Arduino/libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino at master · esp8266/Arduino · GitHub
Unfortunately did not work for !
always connection failed, same for port 80
and website http://jsonplaceholder.typicode.com/users/1 (this gives me result in my code)!
Do you think issue is with my firmware?
Juraj:
it is always better to search information at the relevant source, not everywhere on Internet
Do you know the right place for the information?
1 Like
Juraj
April 4, 2018, 7:53pm
10
shariq_azim:
Do you think issue is with my firmware?Do you know the right place for the information?
what firmware? you use esp8266 arduino core. it is developed by a few people with small help of many other on GitHub. look into reported issues there