cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL & Monster.com

From: B Z <bz029_at_hotmail.com>
Date: Fri, 15 Jul 2005 11:22:45 -0700

So- im trying to visit the following URL to get it to place the cookie in
its header with cURL. this URL is to a certain degree dynamically made from
the java script code on their main page.

I'm hoping that there is a faster way to grab or emulate the URL than disect
the java that created it and recreate the logic on my own to create it from
the ground up in PHP.

I dont quite understand how to use the -e command in cURL for referrer- and
im not sure if that will even help but i would think the only way cURL could
do this(if it can) is with the -H, -e, and -L commands all used in
conjunction. would that be possible? below is the URL and Cookie
information:

http://cookie.monster.com/DCS000003_6D4Q/dcs.gif?&dcsdat=1121374325528&dcssip=www.monster.com&dcsuri=/&WT.tz=-7&WT.bh=13&WT.ul=en-US&WT.cd=32&WT.sr=1280x854&WT.jo=No&WT.ti=Monster%20Jobs%20-%20Get%20work.%20Network.%20Build%20a%20better%20career.%20Today's%20the%20day.&WT.js=Yes&WT.jv=1.5&WT.cg_n=home&WT.mns_tc_wwhp=trump2

GET
/DCS000003_6D4Q/dcs.gif?&dcsdat=1121374325528&dcssip=www.monster.com&dcsuri=/&WT.tz=-7&WT.bh=13&WT.ul=en-US&WT.cd=32&WT.sr=1280x854&WT.jo=No&WT.ti=Monster%20Jobs%20-%20Get%20work.%20Network.%20Build%20a%20better%20career.%20Today's%20the%20day.&WT.js=Yes&WT.jv=1.5&WT.cg_n=home&WT.mns_tc_wwhp=trump2
HTTP/1.1

Host: cookie.monster.com

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0

Accept: image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer: http://www.monster.com/

Cookie:
ez=95101-95103%2b95106%2b95108-95139%2b95141-95142%2b95148%2b95150-95161%2b95164%2b95170-95173%2b95190-95194%2b95196

HTTP/1.x 303 Object Moved

Connection: close

Date: Thu, 14 Jul 2005 20:52:07 GMT

Server: Microsoft-IIS/6.0

Set-Cookie: COOKIE_ID=zzz;expires=Thu, 1 Jan 1970 00:00:00
GMT;path=/;domain=cookie.monster.com;

Set-Cookie: COOKIE_ID=67.172.177.197-3851614720.29722805; expires=Sun,
12-Jul-2015 20:52:07 GMT; domain=.monster.com; path=/

Location:
/DCS000003_6D4Q/dcs.gif?dcsredirect=1&dcsdat=1121374325528&dcssip=www.monster.com&dcsuri=/&WT.tz=-7&WT.bh=13&WT.ul=en-US&WT.cd=32&WT.sr=1280x854&WT.jo=No&WT.ti=Monster%20Jobs%20-%20Get%20work.%20Network.%20Build%20a%20better%20career.%20Today's%20the%20day.&WT.js=Yes&WT.jv=1.5&WT.cg_n=home&WT.mns_tc_wwhp=trump2

Content-Length: 0

P3P: CP="NOI DSP COR NID ADM DEV PSA OUR IND UNI PUR COM NAV INT
STA",policyref="http://media.monster.com/w3c/p3p.xml"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and here is the javascript that creates it- again im hoping cURL has some
way to flow through this and produce the URL for me.... any ideas?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<SCRIPT LANGUAGE="JavaScript"><!--
var gImages=new Array;
var gIndex=0;
var DCS=new Object();
var WT=new Object();
var DCSext=new Object();

var gDomain="cookie.monster.com";
var gDcsId="DCS000003_6D4Q";

// WebTrends SmartSource Data Collector
// © 1996-2004 NetIQ Corporation. All rights reserved.
// DateTime: 2004/05/03 13:43:43

function dcsMultiTrack(){
        for (var i=0;i<arguments.length;i++){
                if (arguments[i].indexOf('WT.')==0){
                                WT[arguments[i].substring(3)]=arguments[i+1];
                                i++;
                }
                if (arguments[i].indexOf('DCS.')==0){
                                DCS[arguments[i].substring(4)]=arguments[i+1];
                                i++;
                }
                if (arguments[i].indexOf('DCSext.')==0){
                                DCSext[arguments[i].substring(7)]=arguments[i+1];
                                i++;
                }
                if (arguments[i]=='gDcsId'){
                                gDcsId=arguments[i+1];
                                i++;
                }
        }
        var dCurrent=new Date();
        DCS.dcsdat=dCurrent.getTime();
        dcsTag();
}

function dcsPrintVariables()
{
        var tagVariables="\nDomain = "+gDomain;
        tagVariables+="\nDCSId = "+gDcsId;
        for (N in DCS){
                tagVariables+="\nDCS."+N+" = "+DCS[N];
        }
        for (N in WT){
                tagVariables+="\nWT."+N+" = "+WT[N];
        }
        for (N in DCSext){
                tagVariables+="\nDCSext."+N+" = "+DCSext[N];
        }
        window.alert(tagVariables);
}

function dcsVar(){
        var dCurrent=new Date();
        WT.tz=dCurrent.getTimezoneOffset()/60*-1;
        if (WT.tz==0){
                WT.tz="0";
        }
        WT.bh=dCurrent.getHours();
        WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
        if (typeof(screen)=="object"){
                WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;
                WT.sr=screen.width+"x"+screen.height;
        }
        if (typeof(navigator.javaEnabled())=="boolean"){
                WT.jo=navigator.javaEnabled()?"Yes":"No";
        }
        if (document.title){
                WT.ti=document.title;
        }
        WT.js="Yes";
        if (typeof(gVersion)!="undefined"){
                WT.jv=gVersion;
        }
        DCS.dcsdat=dCurrent.getTime();
        DCS.dcssip="www.monster.com";
        DCS.dcsuri=window.location.pathname;
        if (window.location.search){
                DCS.dcsqry=window.location.search;
        }
        if ((window.document.referrer!="")&&(window.document.referrer!="-")){
                if (!(navigator.appName=="Microsoft Internet
Explorer"&&parseInt(navigator.appVersion)<4)){
                        DCS.dcsref=window.document.referrer;
                }
        }
}

function A(N,V){
        return "&"+N+"="+dcsEscape(V);
}

function dcsEscape(S){
        if (typeof(RE)!="undefined"){
                var retStr = new String(S);
                for (R in RE){
                        retStr = retStr.replace(RE[R],R);
                }
                return retStr;
        }
        else{
                return escape(S);
        }
}

function dcsCreateImage(dcsSrc){
// window.alert(dcsSrc);
        if (document.images){
                gImages[gIndex]=new Image;
                gImages[gIndex].src=dcsSrc;
                gIndex++;
        }
        else{
                document.write('<IMG BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1"
SRC="'+dcsSrc+'">');
        }
}

function dcsMeta(){
        var myDocumentElements;
        if (document.all){
                myDocumentElements=document.all.tags("meta");
        }
        else if (document.documentElement){
                myDocumentElements=document.getElementsByTagName("meta");
        }
        if (typeof(myDocumentElements)!="undefined"){
                for (var i=1;i<=myDocumentElements.length;i++){
                        myMeta=myDocumentElements.item(i-1);
                        if (myMeta.name){
                                if (myMeta.name.indexOf('WT.')==0){
                                        WT[myMeta.name.substring(3)]=myMeta.content;
                                }
                                else if (myMeta.name.indexOf('DCSext.')==0){
                                        DCSext[myMeta.name.substring(7)]=myMeta.content;
                                }
                                else if (myMeta.name.indexOf('DCS.')==0){
                                        DCS[myMeta.name.substring(4)]=myMeta.content;
                                }
                        }
                }
        }
}

function dcsAddOnClick(){
        var FuncBody={
                get:function(funcPtr){
                        var str=funcPtr.toString();
                        str=str.replace(/[^{]+/,"");
                        str=str.substring(0,str.length-1);
                        return str;
                }
        };
        var clicktrack={
                onclick:function(){
                        dcsMultiTrack('DCSext.click','1','DCSext.url',this.href,'DCSext.id',this.id,'DCSext.name',this.name,'gDcsId','DCS000007_2Q9M');
                        return true;
                }
        };
        var submittrack={
                onsubmit:function(){
                        dcsMultiTrack('DCSext.click','1','DCSext.url',this.action,'DCSext.id',this.id,'DCSext.name',this.name,'gDcsId','DCS000007_2Q9M');
                        return true;
                }
        };
        var myDocumentElements;
        if (document.all){
                myDocumentElements=document.all.tags("a");
        }
        else if (document.documentElement){
                myDocumentElements=document.getElementsByTagName("a");
        }
        if (typeof(myDocumentElements)!="undefined"){
                for (var i=1;i<=myDocumentElements.length;i++){
                        myAnchor=myDocumentElements.item(i-1);
                        if (myAnchor.href){
                            if ( myAnchor.onclick != null ) {
                                        myAnchor.onclick = new
Function(FuncBody.get(myAnchor.onclick)+";"+FuncBody.get(clicktrack.onclick));
                            }
                            else {
                                    myAnchor.onclick = clicktrack.onclick;
                                }
                        }
                }
        }
        if (document.all){
                myDocumentElements=document.all.tags("area");
        }
        else if (document.documentElement){
                myDocumentElements=document.getElementsByTagName("area");
        }
        if (typeof(myDocumentElements)!="undefined"){
                for (var i=1;i<=myDocumentElements.length;i++){
                        myAnchor=myDocumentElements.item(i-1);
                        if (myAnchor.href){
                            if ( myAnchor.onclick != null ) {
                                        myAnchor.onclick = new
Function(FuncBody.get(myAnchor.onclick)+";"+FuncBody.get(clicktrack.onclick));
                            }
                            else {
                                    myAnchor.onclick = clicktrack.onclick;
                                }
                        }
                }
        }
        if (document.all){
                myDocumentElements=document.all.tags("form");
        }
        else if (document.documentElement){
                myDocumentElements=document.getElementsByTagName("form");
        }
        if (typeof(myDocumentElements)!="undefined"){
                for (var i=1;i<=myDocumentElements.length;i++){
                        myForm=myDocumentElements.item(i-1);
                        if (myForm.action){
                            if ( myForm.onsubmit != null ) {
                                        myForm.onsubmit = new
Function(FuncBody.get(myForm.onsubmit)+";"+FuncBody.get(submittrack.onsubmit));
                            }
                            else {
                                    myForm.onsubmit = submittrack.onsubmit;
                                }
                        }
                }
        }
}

function dcsTag(){
        var
P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+gDomain+(gDcsId==""?'':'/'+gDcsId)+"/dcs.gif?";
        for (N in DCS){
                if (DCS[N]) {
                        P+=A(N,DCS[N]);
                }
        }
        for (N in WT){
                if (WT[N]) {
                        P+=A("WT."+N,WT[N]);
                }
        }
        for (N in DCSext){
                if (DCSext[N]) {
                        P+=A(N,DCSext[N]);
                }
        }
        if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
                P=P.substring(0,2040)+"&WT.tu=1";
        }
        dcsCreateImage(P);
}

dcsVar();
dcsMeta();
//dcsPrintVariables();
dcsTag();

dcsAddOnClick();

//-->
</SCRIPT>
Received on 2005-07-15