By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,123 Members | 719 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,123 IT Pros & Developers. It's quick & easy.

How to write cookie in client machine (php)

1clickarticle
P: 1
I want to write the cookie to client machine as the text file format, that can stay at C:\Documents and Settings\Administrator\Cookies.
I just start to set the cookie by

[PHP]<?php
$value = 'I using 1clickarticle.com to post article.';

setcookie("TestCookie", $value);

?>[/PHP]

But I can not find the cookie file in the location i mentioned above.
But I can get this cookie in the php code.

How can I write it in the client machine?

Please help me!

Thank you
Aug 14 '07 #1
Share this Question
Share on Google+
1 Reply

pbmods
Expert 5K+
P: 5,821
Heya, 1clickarticle. Welcome to TSDN!

PHP has no control where the cookie gets stored.

However, if you were to try to access the value via javascript:
Expand|Select|Wrap|Line Numbers
  1. setcookie( ... );
  2.  
  3. .
  4. .
  5. .
  6. ?>
  7. <script type="text/javascript">
  8.     document.write(document.cookie);
  9. </script>
  10.  
Aug 14 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.