cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: PHP/Curl: Any Way to Follow a REFRESH Meta Tag?

From: Keller, Bryan <Bryan.Keller_at_pfizer.com>
Date: Mon, 14 May 2001 14:02:53 -0400

Here's some specific curl requests, and the results, to give more detail
(obviously username/password fields have been changed)...

HTTP Request 1 (username/password & cookies included):

<?php

$usrpsswd = "username:password";

$url =
"http://livelinkpgrd.pfizer.com/livelink/livelink.exe?func=ll&objId=173700&o
bjAction=browse&sort=name";

$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_USERPWD, $usrpsswd);

curl_setopt ($ch, CURLOPT_COOKIE, "LLInProgress=%2F%2F; path=/Livelink/");
curl_setopt ($ch, CURLOPT_COOKIE,
"LLCookie=LIVELINK_PGRD%2Fusername%2Fbase64_encoded_password;
path=/Livelink/");
curl_setopt ($ch, CURLOPT_COOKIE, "LLTZCookie=0; path=/Livelink/");

curl_exec($ch);

curl_close ($ch);

?>

Reply (note: you get the same response from the server whether or not the
cookies are included in the request):

HTTP/1.1 302 Moved Temporarily
Server: Netscape-Enterprise/4.1
Date: Mon, 14 May 2001 17:49:29 GMT
Content-type: text/html
Location:
http://livelinkpgrd.pfizer.com/livelink/livelink.exe?func=LL.Login&NextURL=%
2Flivelink%2Flivelink%2Eexe%3Ffunc%3Dll%26objId%3D173700%26objAction%3Dbrows
e%26sort%3Dname
Content-length: 606 Connection: close

HTTP/1.1 200 O
Server: Netscape-Enterprise/4.1
Date: Mon, 14 May 2001 17:49:29 GMT
Content-type: text/html
Set-cookie: LLInProgress=%2F%2F; path=/livelink/
Set-cookie: LLCookie=LIVELINK_PGRD%2Fusername%2Fbase64_encoded_password;
path=/livelink/
Set-cookie: LLTZCookie=0; path=/livelink/
Content-length: 236
Connection: close

<HTML>
<!-- File: redirectmeta.html -->
<HEAD>
<TITLE>Livelink - Redirection</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="0;
URL=/livelink/livelink.exe?func=ll&amp;objId=173700&amp;objAction=browse&amp
;sort=name">
</HEAD>
</HTML>

HTTP Request 2 (no username/password, just the cookies - this should
simulate the meta refresh in the browser, but doesn't):

<?php

// $usrpsswd = "username:password";

$url =
"http://livelinkpgrd.pfizer.com/livelink/livelink.exe?func=ll&objId=173700&o
bjAction=browse&sort=name";

$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
// curl_setopt ($ch, CURLOPT_USERPWD, $usrpsswd);

curl_setopt ($ch, CURLOPT_COOKIE, "LLInProgress=%2F%2F; path=/Livelink/");
curl_setopt ($ch, CURLOPT_COOKIE,
"LLCookie=LIVELINK_PGRD%2Fusername%2Fbase64_encoded_password;
path=/Livelink/");
curl_setopt ($ch, CURLOPT_COOKIE, "LLTZCookie=0; path=/Livelink/");

curl_exec($ch);

curl_close ($ch);

?>

Reply:

HTTP/1.1 401 Unauthorized
Server: Netscape-Enterprise/4.1
Date: Mon, 14 May 2001 17:52:20 GMT
WWW-authenticate: Basic realm="Pfizer Intranet ID"
Content-length: 223
Content-type: text/html
Connection: close

<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY>
<H1>Unauthorized</H1>
Proper authorization is required for this area. Either your browser does not
perform authorization, or your authorization has failed.
</BODY>
</HTML>

Thoroughly puzzled, hope this is not too specific/boring...

Thanks,

\Bryan

_______________________________________________
Curl-and-php mailing list
Curl-and-php_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-and-php
Received on 2001-05-15