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

PHP, Curl and GoDaddy

P: n/a
Hi everybody,

I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?

Here is what I tried but the result is always the login page.

$curl=curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl,CURLOPT_URL
,"https://idp.godaddy.com/login.aspx?se=%2B&spkey=GDSWEB04&login=&target=sec ure%5Ftransfer%2Easp%3Furl%3D");
curl_setopt($curl,CURLOPT_RETURNTRANSFER ,1 );
curl_setopt($curl,CURLOPT_VERBOSE ,1 );
curl_setopt($curl,CURLOPT_HEADER ,1 );
curl_setopt($curl,CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl,CURLOPT_COOKIEJAR, "-");
curl_setopt($curl,CURLOPT_COOKIEFILE, "");
$result="Page 1:<br>".curl_exec($curl);
curl_setopt($curl,CURLOPT_URL
,"https://idp.godaddy.com/login.aspx?se=%2B&spkey=GDSWEB04&login=&target=sec ure%5Ftransfer%2Easp%3Furl%3D");
curl_setopt($curl,CURLOPT_POST ,1);
curl_setopt($curl,CURLOPT_REFERER
,"http://www.godaddy.com/gdshop/default.asp" );
curl_setopt($curl,CURLOPT_POSTFIELDS
,"UsernameTextBox=OWNUSERID&PasswordTextBox=OWNPAS S");
$result.="Page 2:<br>".curl_exec($curl);
Many thanks for any help, hints or ideas.

Hans

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
*** Hans wrote/escribió (8 May 2005 22:12:46 -0700):
curl_setopt($curl,CURLOPT_COOKIEJAR, "-");
curl_setopt($curl,CURLOPT_COOKIEFILE, "");


I'm not an expert in curl but... What's the purpose of these previous
lines? Discarding cookies? I'm pretty sure you do need cookies in order to
store the session ID value.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2

P: n/a
Hans wrote:
Hi everybody,

I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?

Here is what I tried but the result is always the login page.


Have you used Firefox/Mozilla's "Live HTTP Headers" to log a normal
browsing session? That's usually what I use as the basis of any
CURL-based PHP script I write. What I usually do is clear any cookies or
cached files for the given domain, turn on the HTTP logging, browse
through as I want the CURL script to do and save the resulting logfile
near my script as a reference. Since everything that the site and your
browser are "saying" to each other is in those headers, it gives you a
pretty clear picture of what's going on and will show you any headers
the site may be expecting to get, but your CURL script isn't sending.

J Wynia
Myriad Intellect, Inc.
"Web technology that earns its keep."
www.myriadintellect.com
Jul 17 '05 #3

P: n/a
Hans,
curl_setopt($curl,CURLOPT_COOKIEJAR, "-");
curl_setopt($curl,CURLOPT_COOKIEFILE, "");


In addition you should set the cookiejar and files. It does not
automatically create one for you and the file already must be in place.
I am almost positive that GoDaddy sends a cookie so you might want to
make sure that is in place.

Mike
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.