November 4th, 2012, 09:37 PM
CURL and POST data for website okcupid.com
I'm trying to login with cURL, here's my code, but for some reason I always get a "guest" cookie.
the cookie i get is
$url="(can't post links)://okcupid.com/login";
$postdata = "username=".$username."&password=".$password;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:18.104.22.168) Gecko/20070725 Firefox/22.214.171.124");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
and this is okcupids header sent when i login in chrome
.okcupid.com TRUE / FALSE 1383621437 guest 15740951221743387132
Status Code:302 OK
Request Headersview source
Cookie:authlink=f870d65d; core=0dc1dc60_0.1.3.4.126.96.36.199.188.8.131.52.184.108.40.206.220.127.116.11.108_18.104.22.168.22.214.171.124.126.96.36.199_188.8.131.52.184.108.40.206_87; __qca=P0-436985492-1352084073180; nano=k%3Diframe_prefix_lock_-1%2Ce%3D1352091630912%2Cv%3D1; guest=10124066950966971211; __utma=190145652.1544842371.1352082754.1352082754.1352091631.2; __utmb=1901456220.127.116.112091631; __utmc=190145652; __utmz=190145652.1352082754.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
Form Dataview URL encoded
Response Headersview source
Date:Mon, 05 Nov 2012 05:00:46 GMT
P3P:CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT", policyref="http://www.okcupid.com/w3c/p3p.xml"
Set-Cookie:session=13615928895210954110%3a6209522096584548404; expires=Tue, 05 Nov 2013 05:00:46 GMT; path=/; domain=okcupid.com
Set-Cookie:guest=; expires=Sun, 04 Nov 2012 05:00:46 GMT; path=/; domain=okcupid.com
December 13th, 2013, 02:55 PM
Any Luck Logging in to OKCwith CURL?
Hi I'm trying to do the same thing. Have you had any luck getting this to work?
Would you be willing to share any code updates so I can get mine working?
If you didn't get it working, I can provide you a link to a project I found logging in with python.
Originally Posted by durrrrr
December 16th, 2013, 08:13 AM
Durrrrr never came back to the forum after posting his initial question. I doubt you'll get any response here.
Why are you trying to write an automated script to log into OKC? Are you sure it's not against their terms of service to do so? Most of these bots are used to generate cyberbully websites so they don't get much community support.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.
December 16th, 2013, 02:13 PM
Thanks for posting ManiacDan!
Originally Posted by ManiacDan
I ended up getting curl working and my awesome site is up and runnig.
I'm not sure its not against their policy, but at the moment I have my crawl rates set pretty low so I don't think i'm abusing it. maybe I'll get around to reading their terms and policy...
Anyway thanks for posting!
Last edited by ManiacDan; December 17th, 2013 at 08:08 AM.
February 11th, 2014, 04:52 PM
would you be willing to share your code? I'm attempting to do something sort of similar with curl and running into problems. Thanks!
Originally Posted by webalchemist