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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.