View Full Version : cookies and phpdig

02-05-2004, 04:56 AM
Hi all,

Does phpDig send cookies along with the links it follows?

I have set up a website :

index.php sets a cookie named "TEST"
if the cookie is set correctly a link Next (to Next.php) appears, if you follow this link the cookie "TEST" is red using $_COOKIES["TEST"]
if the cookie is found a link Set (to Set.php) appears otherwise a link NotSet (to NotSet.php) appears

phpDig always follows the link : NotSet.php

SITE : http://www.harmoni-ca.info/
Exclude paths :
- @NONE@
(time : 00:00:05)
level 1...
(time : 00:00:15)
No link in temporary table

Should I adjust the configuration file for phpDig to send the cookie ?

Thx :))

02-05-2004, 10:27 AM
Hi. If you look in robot_functions.php for the phpdigTestUrl function and in this function look for "parse cookies" you will see some code. Compare this code with the examples on this (http://magni.grainger.uiuc.edu/lis450ds/http_examples.htm) page and look at the phpDigMakeCookies function in robot_functions.php to see how PhpDig creates the $cookiesSendString variable.

03-05-2004, 07:38 PM
Be careful though, the phpDigSetHeaders() function makes an ini_set('user_agent'...) call that isn't supported in versions of php < 4.3 (afaik)

As far as I can tell from the phpdig code, in versions of PHP 4.1 and 4.22 (the ones I tested on) Cookies are not sent properly for GET requests, only HEAD requests.

This is because the actual GET request of a file done in the phpdigTempFile(...) function is done using the PHP file(...) function not a home made GET request.

I think the authors use of ini_set to pass along the cookies is quite clever, it's too bad it's not supported in earlier versions of PHP.