cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_HTTPAUTH and Digest Authorization Required

From: Jon M <removed_at_removed>
Date: Sat, 19 Feb 2005 12:06:33 -0500

I'm having authentication errors. I've read through the archives and found a
couple instances where people seemed to have similar problems, but that was
years and versions ago.

(e.g. http://curl.haxx.se/mail/lib-2003-07/0132.html)

Any help is appreciated. I'm just trying to CURL my TiVo.

The system in question has: libcurl/7.10.3, OpenSSL/0.9.6m, zlib/1.2.2, PHP
Version 4.3.10

My code is as follows

----
<?php
$your_tivo_ip = "68.00.000.00;
$mak = "0000000000";
$your_tivo_port = "443";
$username = "tivo";
$url = "/nowplaying/index.html?Recurse=Yes";
$fullurl = "https://$your_tivo_ip:$your_tivo_port$url";
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_HEADER, 1);
   curl_setopt($ch, CURLOPT_VERBOSE, 1);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_FAILONERROR, 0);
   curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
   curl_setopt($ch, CURLOPT_USERPWD, "$username:$mak");
   curl_setopt($ch, CURLOPT_URL, $fullurl);
   $returned = curl_exec($ch);
   echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>';
   curl_close ($ch);
   echo $returned;
?>
--
The resulting output is this:
----------------------------------------------------------------------------
----
Errors: 0 
HTTP/1.1 401 Digest Authorization Required Server:
tivo-httpd-1:7.1a-01-2:240 Set-Cookie: sid=3E5B41DEB106BDBC; path=/;
expires="Saturday, 16-Feb-2013 00:00:00 GMT"; WWW-Authenticate: Digest
realm="TiVo DVR", nonce="B20529B58FE45E12", qop="auth" Content-Length: 38
Content-Type: text/html Connection: keep-alive Keep-Alive: max=10,
timeout=30 
Digest Authorization Required
----------------------------------------------------------------------------
----
Received on 2005-02-19