IP Login

Should IPLogin work when using curl?

1 year 4 months ago #87600

Helen Chappell's Avatar Helen Chappell

I'm using curl in a bash script on AWS EC2 server and want to use IPLogin. Should this work? I'm using the public ip of the ec2 server.
Thanks,
Helen

1 year 4 months ago #87601

Peter van Westen's Avatar Peter van Westen Admin

I think so.
Make a little php script that outputs te ip address. And see what you get when using curl to query that url (php script).

1 year 4 months ago #87603

Helen Chappell's Avatar Helen Chappell

Thank you for the super fast response.

I did that and the IP address I'm using seems to be correct. I get it using the following snippet:

if(!empty($_SERVER['HTTP_CLIENT_IP'])){
        //ip from share internet
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
        //ip pass from proxy
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }else{
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    return $ip;

It works from my browser on local machine (with IP changed accordingly). But no dice when I try to run a page requiring login from the Linux box.

Not a showstopper but if you have any ideas they would be appreciated.

Thanks,
Helen

1 year 4 months ago #87605

Peter van Westen's Avatar Peter van Westen Admin

You might want to 'follow redirects' and try some other curl options.
And maybe use wget instead of curl.