PHP, Curl and GoDaddy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hans

    PHP, Curl and GoDaddy

    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($cu rl, CURLOPT_SSL_VER IFYPEER, FALSE);
    curl_setopt($cu rl,CURLOPT_URL
    ,"https://idp.godaddy.com/login.aspx?se=% 2B&spkey=GDSWEB 04&login=&targe t=secure%5Ftran sfer%2Easp%3Fur l%3D");
    curl_setopt($cu rl,CURLOPT_RETU RNTRANSFER ,1 );
    curl_setopt($cu rl,CURLOPT_VERB OSE ,1 );
    curl_setopt($cu rl,CURLOPT_HEAD ER ,1 );
    curl_setopt($cu rl,CURLOPT_FOLL OWLOCATION, 1);
    curl_setopt($cu rl,CURLOPT_COOK IEJAR, "-");
    curl_setopt($cu rl,CURLOPT_COOK IEFILE, "");
    $result="Page 1:<br>".curl_ex ec($curl);
    curl_setopt($cu rl,CURLOPT_URL
    ,"https://idp.godaddy.com/login.aspx?se=% 2B&spkey=GDSWEB 04&login=&targe t=secure%5Ftran sfer%2Easp%3Fur l%3D");
    curl_setopt($cu rl,CURLOPT_POST ,1);
    curl_setopt($cu rl,CURLOPT_REFE RER
    ,"http://www.godaddy.com/gdshop/default.asp" );
    curl_setopt($cu rl,CURLOPT_POST FIELDS
    ,"UsernameTextB ox=OWNUSERID&Pa sswordTextBox=O WNPASS");
    $result.="Page 2:<br>".curl_ex ec($curl);


    Many thanks for any help, hints or ideas.

    Hans

  • Alvaro G Vicario

    #2
    Re: PHP, Curl and GoDaddy

    *** Hans wrote/escribió (8 May 2005 22:12:46 -0700):[color=blue]
    > curl_setopt($cu rl,CURLOPT_COOK IEJAR, "-");
    > curl_setopt($cu rl,CURLOPT_COOK IEFILE, "");[/color]

    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
    --

    Comment

    • J Wynia

      #3
      Re: PHP, Curl and GoDaddy

      Hans wrote:[color=blue]
      > 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.[/color]

      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."

      Comment

      • Mike Willbanks

        #4
        Re: PHP, Curl and GoDaddy

        Hans,
        [color=blue]
        > curl_setopt($cu rl,CURLOPT_COOK IEJAR, "-");
        > curl_setopt($cu rl,CURLOPT_COOK IEFILE, "");[/color]

        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

        Comment

        Working...