Read .net Cookie Value w/PHP

Discussion in 'PHP' started by mrbee2828, May 8, 2008.

  1. #1
    Hi all, I have a strange situation. We're working on a site in parallel with another programmer. We're using PHP for all the pages and he has a .net cart solution. Everything seems to be fine except for 1 small issue on the PHP nd that's reading from one of his cookies. He has the .net & .php in a different folder structure so I don't know if that plays into it.

    (BTW this is a case of "I found someone to do the cart cheaper")

    We just need to get the # of items in the cart from it to show in the menu! This is what we got from the developer:

    Cookie Name : anetsoft
    Key Name: Wholesale
    Key Name: CartItemCount

    Values are 0,1,2,3 etc....

    Here is the simple PHP which echos nothing:

    
    	$cart = $_COOKIE["CartItemCount"];
    	$type = $_COOKIE["Wholesale"];
    	echo("cart contents: " . $cart . "<br/><br/>");
    	echo("user type: " . $type);
    
    Code (markup):
    and we've tried:

    
    	$cart = $HTTP_COOKIE_VARS["CartItemCount"];
    	$type = $HTTP_COOKIE_VARS["Wholesale"];
    	echo("cart contents: " . $cart . "<br/><br/>");
    	echo("user type: " . $type);
    
    Code (markup):
    Any ideas?
     
    mrbee2828, May 8, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Try this to see what cookies are set. Make sure that you have visited one of the .net pages that would set a cookie.

    
    
    echo "<pre>";
    print_r($_COOKIE);
    echo "</pre>";
    
    
    PHP:
    My guess is that you would need to access the cookie like $_COOKIE['anetsoft'];
     
    jestep, May 8, 2008 IP
  3. mrbee2828

    mrbee2828 Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. Another hang up is that we aren't allowed to FTP to this staging server so QA is a hassle of emailing files to "try and see if this works". I will email him a new file. Is it possible to do something like this? (I'm guess no)

    
    $_COOKIE["anetsoft"]["Wholesale"];
    
    Code (markup):
     
    mrbee2828, May 8, 2008 IP