Why don't you use cURL functions (if you have them compiled)?
These functions offer CURLOPT_COOKIE where the data will be sent automatically. Then there will be no need to write your own code.
If you don't have cURL then I recommend using fsock() rather than fopen() for compatibility reasons if you have to migrate to another host. Not all hosts have all file wrappers or even URL wrappers enabled for fopen().
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.