0

I have a problem with my http request. I send a http request to server(using firefox): the requestheader

Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Accept: text/html, */*; q=0.01
Accept-Language: vi-VN,vi;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: text/plain; charset=UTF-8
Pragma: no-cache
Cache-Control: no-cache
Referer: http://localhost/home1/
Content-Length: 15
Cookie: _ga=GA1.1.868084363.1437301524
Connection: keep-alive

**request body**:


 `ip=192.168.1.13`

**This is my code on server:**

if(isset($_POST['ip'])){
        $ip = $_POST["ip"];
        echo getLightStatusById($ip).'&'.getSuccess($ip)."eos";
    }else{
        echo 'error';
    }  

I received message:

error

if i don't have if condition, i received:

undefined index...

What am i wrong? Thank you!

user3326893
  • 5
  • 1
  • 7
  • I posted the same question. When i work with my device (esp8266). The problem is my device. But this i try on firefox why can't i do? http://stackoverflow.com/questions/30308948/http-post-request-difference-from-firefox-and-example/30340680?noredirect=1#comment48861800_30340680 – user3326893 Sep 17 '15 at 16:36
  • I vote to re-open. This question doesn't seem to be about the "undefined index" error. It's more about why the variable is not posted. – showdev Sep 17 '15 at 17:22

0 Answers0