Jump to content

PHP cURL - Web - Based Login Help Required


crazy.dude

Recommended Posts

Hello,

 

Take a look at the bellow code.

 

<?php
// Internal IP
$ip = "192.168.1.1"; // assume it could be anything!

// Login page URL
$url = "http://".$ip."/login.php";

// Bandwidth graphs from switch/router
$bw_5 = "http://".$ip."/traffic.php?dedi=rack3&server=2";

// The cURL part
$bw_5 = curl_init();
curl_setopt($bw_5, CURLOPT_URL, $url);
curl_setopt($bw_5, CURLOPT_POST, 1);
curl_setopt($bw_5, CURLOPT_POSTFIELDS, "username=USERNAME&password=PASSWORD");
curl_setopt($bw_5, CURLOPT_TIMEOUT, 10);
curl_setopt($bw_5, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($bw_5, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($bw_5, CURLOPT_VERBOSE, 1);
curl_setopt($bw_5, CURLOPT_HEADER, 1);

$data = curl_exec($bw_5);
echo $data;
curl_close($bw_5);
?>

 

Once logged in at login.php, it automatically redirects back to $ip. But I need the script to then fetch the dynamic "image" given out at /traffic.php?dedi=rack3&server=2. So I how do I make it run to /traffic.php?dedi=rack3&server=2 once its logged in?

 

Thanks to everyone in advance :)

 

Regards,

crazy.dude

 

Link to comment
https://forums.phpfreaks.com/topic/87093-php-curl-web-based-login-help-required/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.