curl-and-php
COOKIE PROBLEM
Date: Sun, 1 Jun 2008 03:43:59 +0200
Hello,
I got stucked with a trivia problem (I believe) in my script, but
can't find answer at any forums. Hopping you guys may help a bit. Let
me explain:
I am writing a short php-curl script for testing our website
developments. It supposes to connect to our website's test pages and
display the content.
The pages checks session and visitors cookies to hide (on any multiple
visit) certain div on the page, containing the keyword. Therefore for
testing purposes we need to connect via anonymous proxies to simulate
original visits from outside.
The part with analysis of the fetched content of keyword match works
flawless.
The page-load in a browser is also working well.
The only problem I have is this:
When I am connecting to the specific testpage via anonymous proxies -
and changing the proxy address for each request - the page recognizes
my identity and hides the div. When using two IPs for two requests,
the page "knows" it is the 2nd time.
The problem disappears if I turn off the session and visitor cookies
as admin of the websites, therefore I think it has to do something
with managing cookies in curl sessions.
I played a lot with different cookie setups, it did not count. I am
still getting the same visitor ID in header's cookies. Please help:
----------------------------------------------------------------
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt ($ch, CURLOPT_PROXY, $proxyFull);
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, $proxyUser:$proxyPass);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT,
curl_setopt ($ch, CURLOPT_ENCODING, "");
curl_setopt ($ch, CURLOPT_TIMEOUT, $curlTO);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $curlRuntimeTO);
curl_setopt ($ch, CURLOPT_USERAGENT, $UAgent);
curl_setopt ($ch, CURLOPT_REFERER, $Referer);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
$content = curl_exec ($ch);
$curl_info = curl_getinfo($ch);
curl_close ($ch);
echo $content;
----------------------------------------------------------------
thank you and have good days
Tom Respec
WebNow, Inc.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-06-01