I use the php-curl-class I like to check that the login data are correct. The download area is protected with htaccess and if the login data correct the download start. If the login data not correct the download don't start, but i get the HttpStatusCode 200! Her my complette code, sorry if my description not enough, but what more should explain?
$HttpStatusCode = false;
$curl->setBasicAuthentication(user, pw);
if ($curl->getHttpStatusCode() !== '401') {
$tmpfile = $_GET['vers'];
$tmppath = $_GET['path'].'/';
$curl->download(DOWNLOAD_PATH.$tmppath.$tmpfile, function ($instance, $tmpfile) {
$save_to_path = FS_UPDATES . basename($instance->url);
$fh = fopen($save_to_path, 'wb');
stream_copy_to_stream($tmpfile, $fh);
fclose($fh);
});
$curl->close;
} else {
$HttpStatusCode = true;
}
I get all the time HttpStatusCode 200
! The download only start if the login data correct. Thats okay, but how to check the login is wrong? I would very appreciate if anyone can help me, because the examples didn't help me.
Thanks in advance!!