drewbee Posted July 18, 2007 Share Posted July 18, 2007 Hello everyone, I currently have a curl session that can access hundreds of different pages on a site. One thing I noticed with it is that it is initiating a new session of the server that is accessing. I don't want it to create a million sessions, just use the one it currently has. I am going to guess that if curl_close($ch) is called, then it is is reinitiated curl_init, it restarts the session correct? Is their a way for it to maintain the same connection that I missed somewhere, or do I need to do some if/elses to check for an already open curl session?? Thank you for your insight. Drew Link to comment https://forums.phpfreaks.com/topic/60470-solved-curl-creates-new-session/ Share on other sites More sharing options...
lightningstrike Posted July 18, 2007 Share Posted July 18, 2007 Well the only solution I can think of would be to access the website initially, and read the headers to save the cookie. Then save the sessionid to a variable. Then when starting a new cURL session to send in the headers cookie information with the sessionid. Link to comment https://forums.phpfreaks.com/topic/60470-solved-curl-creates-new-session/#findComment-300803 Share on other sites More sharing options...
drewbee Posted July 18, 2007 Author Share Posted July 18, 2007 Yeah, I tried keeping the $ch handle alive but that didn't work either, so it will be what i will have to do. Thanks Link to comment https://forums.phpfreaks.com/topic/60470-solved-curl-creates-new-session/#findComment-300804 Share on other sites More sharing options...
drewbee Posted July 18, 2007 Author Share Posted July 18, 2007 Do you happen to know how the search engines react to this kind of situation, whether they hold the same session while their browsing like crazy bots throughout the site, or if they are just initiating a new session on each grab?. Link to comment https://forums.phpfreaks.com/topic/60470-solved-curl-creates-new-session/#findComment-300805 Share on other sites More sharing options...
lightningstrike Posted July 18, 2007 Share Posted July 18, 2007 I'm pretty sure, most search engines ignore javascript and cookie headers. So they usually generate tons of sessions, like googlebot and the yahoo bot who cause message boards guest numbers to skyrocket. Unless of course the website appends the Session id to the links. Link to comment https://forums.phpfreaks.com/topic/60470-solved-curl-creates-new-session/#findComment-300806 Share on other sites More sharing options...
drewbee Posted July 18, 2007 Author Share Posted July 18, 2007 Yeah, that is what I was guessing too. I know all the major boards usually have an entire section of code dedicated to identifying search engines and labeling them (or ignoring them). I guess i'll have to tell people to handle my bot accordingly when it comes to their site. Thanks for the insight. Link to comment https://forums.phpfreaks.com/topic/60470-solved-curl-creates-new-session/#findComment-300808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.