Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 89679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:45:15+00:00 2026-05-10T22:45:15+00:00

In the application I’m writing using a combination of development environments and languages, I

  • 0

In the application I’m writing using a combination of development environments and languages, I have need of accessing a cookie from two different subdomains, each on a separate host.

The cookie is being set on www.mydomain.com using the PHP code that follows, and I’m attempting to access it from distant.mydomain.com on a separate host.

setcookie('token', base64_encode(serialize($token)), time()+10800, '/', '.mydomain.com');   

I’m trying to access the cookie from distant.mydomain.com using the following code:

if (isset($_COOKIE['token'])) { /* do stuff */ }   

The problem: distant.mydomain.com is not finding the cookie. The if statement just mentioned returns false, even though the cookie exists.

I have verified that the cookie that is set is for mydomain.com (by checking my Firefox cookies). I can’t think of any reason this wouldn’t be working.

Using the same setcookie code, I have an old application running exclusively on the www.mydomain.com host, and that application is able to access the cookie across domains. This makes me suspect that the problem has to do with separate hosts.

Just in case any of the following information is pertinent:
– www.mydomain.com is IIS 6.0
– distant.mydomain.com is Apache 2.2.9
– Both servers use PHP 5.2.x
– Both servers are operating on Windows Server 2003

If there is any further information I can provide in order to better describe the problem, please let me know!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:45:16+00:00Added an answer on May 10, 2026 at 10:45 pm

    For the benefit of anyone reading this question the code and information contained in the original post are exactly correct and work fine.

    The problem is when you introduce other technology. For instance, I have since learned that sending PHP code through a Python module, one that allows Django to serve PHP files/content, changes a great deal about what is accessible to the script and what is not.

    This was eventually discovered following the advice of Marc Novakowski, who suggested sending $_COOKIE to the log in order to find out what was there.

    I also checked out $_SERVER and $_GET. It was the emptiness of $_GET that tipped me off that the setup I am attempting to use is not as straightforward as I had thought. It was that mistaken understanding that led to not including the information about Django in the original post.

    Apologies and thanks to all who responded to this question!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 97k
  • Answers 97k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use sum() to sum the values of an… May 11, 2026 at 7:19 pm
  • Editorial Team
    Editorial Team added an answer Since look-behind assertions are zero-width (i.e. they don't consume any… May 11, 2026 at 7:19 pm
  • Editorial Team
    Editorial Team added an answer On my trackpad, your code works perfectly fine, but i… May 11, 2026 at 7:19 pm

Related Questions

In the application I'm developping (in Java/swing), I have to show a full screen
In the application I am developing I have to store the time some particular
In the application I'm writing using a combination of development environments and languages, I
In the application I'm working on porting to the web, we currently dynamically access
In one part of the application I'm working on, there is a form control

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.