Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    ASP Cookies with PHP

    I have a PHP script that I am trying to get to work with ASP. I am using PHP to access a LDAP database then it needs to pass some data to a ASP page. I could do it through a URL, but we would like to keep the data off of the address line. I have ask the ASP guy to send me a ASP script to read cookies from the PHP page so that I could get the cookies correct. When I run the PHP script I get a cookie that seems to have the correct data in it but I don't know if it is in the correct form.
    My PHP script is:
    <?php
    setcookie("UserInfo['Name']","jones",time()+3600,"/","mypage.org");
    setcookie("UserInfo['School']","prek",time()+3600,"/","mypage.org");
    setcookie("UserInfo['Email']","jonest",time()+3600,"/","mypage.org");
    echo"<a href='http://www.mypage.org/timeatscookies.asp'> go";
    ?>
    and the ASP to read it is:
    <%
    response.write(request.cookies("UserInfo")("Name")) & "<br>"
    response.write(request.cookies("UserInfo")("School")) & "<br>"
    response.write(request.cookies("UserInfo")("Email")) & "<br>"
    %>

    Yum, Yum!!!

    All that I get is the Yum, Yum!!!
    Does anyone have any suggestions on how to write the cookie so that ASP can read it? If anyone has any other suggestions for good ways to get the data to the ASP script I am open to looking at other options.

    Thanks
    Last edited by jonest454; 11-08-2007 at 09:20 PM. Reason: correctiong the domain

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Does ASP store the cookies with keys like that (Userinfo['Name'])?
    There's a snippet to list all cookies at the bottom of this page. You probably just have the name wrong. Or are you trying to read cookies from another domain?

  • Users who have thanked Inigoesdr for this post:

    jonest454 (11-08-2007)

  • #3
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for your quick reply.

    I wish that I could answer your question about how the ASP stores the cookies with keys, but ............. what I know about ASP....... well I can spell ASP and that is about it....
    Right now the ASP page is on a server and the PHP page is on my laptop. I have set a host file to point tim.mypage.org to go to 127.0.0.1 so I tricked my laptop to use the same domain. The cookie that is stored on my laptop has the correct domain name on it. I had changed the domain name on the code that I posted, but did not change it in all of the code. I have edited it now.
    I was hoping that I could have the ASP people let me know how they wanted the data and I could give it to them in a way where they did not have to change the existing ASP scripts more than needed. If things need to be changed on the ASP side then I will pass that information along, But the only thing that I have any control over is the PHP coding.

    Again thanks for any information


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •