ratcateme Posted February 26, 2008 Share Posted February 26, 2008 I want to make get a page using CURL. the page gets a value from a cookie but i don't no how to set a cookie any ideas?? Scott. Quote Link to comment https://forums.phpfreaks.com/topic/93032-curl-request-with-cookie/ Share on other sites More sharing options...
Lamez Posted February 26, 2008 Share Posted February 26, 2008 maybe this will help: <?php $Month = 2592000 + time(); //this adds 30 days to the current time setcookie(AboutVisit, date("F jS - g:i a"), $Month); ?> I found it here: http://php.about.com/od/advancedphp/qt/php_cookie.htm You could also take a look at one of these: http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=how+to+set+a+cookie+in+PHP Quote Link to comment https://forums.phpfreaks.com/topic/93032-curl-request-with-cookie/#findComment-476624 Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url ); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, $reffer); $html = curl_exec ($ch); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_close ($ch); ? Whats in my cookie.txt: # Netscape HTTP Cookie File # http://curlm.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. en.mapleeurope.com FALSE / FALSE 0 ASP.NET_SessionId ru4s2wzve0uypn453fxdn255 .mapleeurope.com TRUE / FALSE 2147483647 EMSUserAreaInfo UserCountryCode=NL&UserIPAddress=68.61.224.221 .mapleeurope.com TRUE / FALSE 0 pageLan 1nDyHvJz5W8= Quote Link to comment https://forums.phpfreaks.com/topic/93032-curl-request-with-cookie/#findComment-476638 Share on other sites More sharing options...
ratcateme Posted February 26, 2008 Author Share Posted February 26, 2008 Thanks thats what i was looking for wheres topic soloved?? Scott. Quote Link to comment https://forums.phpfreaks.com/topic/93032-curl-request-with-cookie/#findComment-476651 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.