Go Down

Topic: How to fix send http to web browser -ESP8266 /XAMPP (Read 460 times) previous topic - next topic

samerou

I'm working on Homework which will allow me to send specific address to web browser in order to execute Something but the problem that I keep getting access denied and Failure when trying to post http address to browser VIA esp8266

this is my code :


 
Code: [Select]
 

    #include <Arduino.h>

    #include <ESP8266WiFi.h>
    #include <ESP8266WiFiMulti.h>

    #include <ESP8266HTTPClient.h>

    #define USE_SERIAL Serial

    ESP8266WiFiMulti WiFiMulti;

    void setup() {

    USE_SERIAL.begin(115200);
    // USE_SERIAL.setDebugOutput(true);

    USE_SERIAL.println();
    USE_SERIAL.println();
    USE_SERIAL.println();

    for(uint8_t t = 4; t > 0; t--) {
        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
        USE_SERIAL.flush();
        delay(1000);
    }

    WiFi.mode(WIFI_STA);
    WiFiMulti.addAP("itserv", "azerty98769876");

    }
                                                                                                                                                                                                                                 
    void loop() {
          // wait for WiFi connection
      if((WiFiMulti.run() == WL_CONNECTED)) {

        HTTPClient http;

        USE_SERIAL.print("[HTTP] begin...\n");
        // configure traged server and url

        http.begin("https://192.168.8.100:80\info.php?request=testing");             
        USE_SERIAL.print("[HTTP] GET...\n");
        // start connection and send HTTP header
        int httpCode = http.GET();

        // httpCode will be negative on error
        if(httpCode > 0) {
         
            USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                String payload = http.getString();
                USE_SERIAL.println(payload);
            }
        } else {
            USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }

        http.end();
    }

    delay(10000);
     }



and then errow is below  :

Code: [Select]
01:38:03.235 ->
01:38:03.235 ->
01:38:03.235 ->
01:38:03.235 -> [SETUP] WAIT 4...
01:38:04.247 -> [SETUP] WAIT 3...
01:38:05.269 -> [SETUP] WAIT 2...
01:38:06.255 -> [SETUP] WAIT 1...
01:38:07.258 -> [HTTP] begin...
01:38:07.258 -> [HTTP] GET...
01:38:07.258 -> [HTTP] GET... failed, error: connection refused
01:38:17.272 -> [HTTP] begin...
01:38:17.272 -> [HTTP] GET...
01:38:17.272 -> [HTTP] GET... failed, error: connection refused
01:38:27.256 -> [HTTP] begin...
01:38:27.256 -> [HTTP] GET...
     01:38:27.256 -> [HTTP] GET... failed, error: connection refused
     01:38:37.236 -> [HTTP] begin...
     01:38:37.236 -> [HTTP] GET...
     01:38:37.236 -> [HTTP] GET... failed, error: connection refused


I tried many things , any idea are welcome


Best Regars ,
sam

Juraj


samerou

92.168.8.100:80\info.php?

\ /
I did the change mentionned but I got the same problem ,  I didn't find away to send http into browser web

Juraj

I did the change mentionned but I got the same problem ,  I didn't find away to send http into browser web
https

did you setup SSL on server and on esp8266?

samerou

https

did you setup SSL on server and on esp8266?
could explain more please : SSL on server and ESP8266 .?

Juraj

could explain more please : SSL on server and ESP8266 .?

you have https protocol in the url. why?

samerou

you have https protocol in the url. why?
I was just trying to solve by typing  http:// or  https:// or even without the http:// just like this 

192.168.8.100:80/info.php?request=testing

Juraj

and does
http://192.168.8.100/info.php?request=testing
work?

samerou

and does
http://192.168.8.100/info.php?request=testing
work?
and does
http://192.168.8.100/info.php?request=testing
work?
When I test that URL manually without using ESP8266  , it worked perfectly  but I can't figure it out how to communicate ESP8266 with web browser

Juraj

the browser run on the server computer? is the port 80 open on firewall on server computer?

samerou

the browser run on the server computer? is the port 80 open on firewall on server computer?
Xampp is installed on my computer and run there,,

Esp8266 is connected via serial port and try to communicate with xampp

And yes 80 open on firewall but Is that an issue?

Juraj

Xampp is installed on my computer and run there,,

Esp8266 is connected via serial port and try to communicate with xampp

And yes 80 open on firewall but Is that an issue?
a closed port would be an issue of course. you make a request to a web server running on port 80

samerou

#12
May 07, 2019, 11:36 am Last Edit: May 07, 2019, 11:52 am by samerou
a closed port would be an issue of course. you make a request to a web server running on port 80
I tried it and I allowed my port to bypass firewall but without success , I cannot connect to my XAMPP server


PS : When I run the code with something different then http://192.168.8.100:80/info.php?request=testing    somthing like www.google.com  it works perfectly

samerou


Go Up