Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 576045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:00:20+00:00 2026-05-13T14:00:20+00:00

EDIT: I added a bounty, if someone could help me figure out what I

  • 0

EDIT: I added a bounty, if someone could help me figure out what I am doing wrong, its all yours.

Also, I don’t really care how this gets done. If there is a library that can help out, or something of that sort that would be great.

Since there is no Captcha involved, I should theoretically be able to log into Flickr and add a contact through code similar to the following…correct?

When I run this code and many many variants of it when I get to the place where I am supposed to submit a form to verify that I am adding a contact, it asks me to log in. Is the only thing this could be my failure to collect the right cookie?

I have IEHTTPHeader for IE to look at whats actually happening and I am trying my best to emulate it. I just can’t find where I am going wrong unless I just don’t understand something.

Flickr API can’t do this

All I want to do is login and add a predefined contact.

        //This Kicks off the process
        private void button2_Click(object sender, EventArgs e)
        {
            string user = "adampeditto"; //Some Random Guy
            CookieContainer cookies = new CookieContainer();
            cookies = LoginYahoo(cookies, user);
            cookies = GetCookies(cookies, user);
            cookies = ClickFlickrButton(cookies, user);
        }

        private CookieContainer ClickFlickrButton(CookieContainer cookies, string user)
        {
            try
            {
                string appURL = "http://www.flickr.com/people/" + user + "/relationship";
                string strPostData = "magic_cookie=a9dd9cd9fd23081f35b8bad2c0ba1878&done=1";

                // Setup the http request.
                HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as HttpWebRequest;
                wrWebRequest.Method = "POST";
                wrWebRequest.Timeout = 10000;
                wrWebRequest.ContentLength = strPostData.Length;
                wrWebRequest.ContentType = "application/x-www-form-urlencoded";
                CookieContainer cookieContainer = cookies;
                wrWebRequest.CookieContainer = cookieContainer;

                // Post to the login form.
                StreamWriter swRequestWriter = new
                StreamWriter(wrWebRequest.GetRequestStream());
                swRequestWriter.Write(strPostData);
                swRequestWriter.Close();

                // Get the response.
                HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();

                // Read the response
                StreamReader srResponseReader = new StreamReader(hwrWebResponse.GetResponseStream());
                string strResponseData = srResponseReader.ReadToEnd();
                srResponseReader.Close();

                return cookieContainer;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private CookieContainer LoginYahoo(CookieContainer cookies, string user)
        {
            string loginName = "YourLoginName";
            string password = "YourPassword";
            string appURL = "https://login.yahoo.com/config/login?.src=flickr&.pc=5134&.scrumb=0&.pd=c%3DE0.GahOp2e4MjkX.5l2HgAoLkpmyPvccpVM-&.intl=us&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Fvalidate%3F.src%3Dflickr%26.pc%3D5134%26.scrumb%3D0%26.pd%3Dc%253DE0.GahOp2e4MjkX.5l2HgAoLkpmyPvccpVM-%26.intl%3Dus%26.done%3Dhttp%253A%252F%252Fwww.flickr.com%252Fsignin%252Fyahoo%252F%253Fredir%253D%25252Fpeople%25252F" + user + "%25252Frelationship%25252F&rl=1";
            string strPostData = ".tries=1&.src=flickr&.md5=&.hash=&.js=&.last=&promo=&.intl=us&.bypass=&.partner=&.u=0delt5h5l4df0&.v=0&.challenge=3DZF0DFFqdE0m.9MWnCq6LjUZ9gV&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=1&.chkP=Y&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Fvalidate%3F.src%3Dflickr%26.pc%3D5134%26.scrumb%3D0%26.pd%3Dc%253DE0.GahOp2e4MjkX.5l2HgAoLkpmyPvccpVM-%26.intl%3Dus%26.done%3Dhttp%253A%252F%252Fwww.flickr.com%252Fsignin%252Fyahoo%252F%253Fredir%253D%25252Fpeople%25252F" + user + "%25252Frelationship%25252F&.pd=flickr_ver%3D0%26c%3DE0.GahOp2e4MjkX.5l2HgAoLkpmyPvccpVM-%26ivt%3D%26sg%3D&login=" + loginName + "&passwd=" + password + "&.persistent=y&.save=Sign+In";

            // Setup the http request.
            HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as

            HttpWebRequest;
            wrWebRequest.AllowAutoRedirect = true;
            wrWebRequest.Method = "POST";
            wrWebRequest.ContentLength = strPostData.Length;
            wrWebRequest.ContentType = "application/x-www-form-urlencoded";
            CookieContainer cookieContainer = cookies;
            wrWebRequest.CookieContainer = cookieContainer;

            // Post to the login form.
            StreamWriter swRequestWriter = new
            StreamWriter(wrWebRequest.GetRequestStream());
            swRequestWriter.Write(strPostData);
            swRequestWriter.Close();

            // Get the response.
            HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();

            // Read the response
            StreamReader srResponseReader = new
            StreamReader(hwrWebResponse.GetResponseStream());
            string strResponseData = srResponseReader.ReadToEnd();
            srResponseReader.Close();

            //YOU ARE NOW LOGGED IN TO YAHOO!
            ShowInBrowser(strResponseData);
            return cookieContainer;
        }

        //These are the places it sends you upon autoredirect after your run LoginYahoo(), if you set AutoRedirect to true there should be no need for this...
        private CookieContainer GetCookies(CookieContainer cookies, string user)
        {
            CookieContainer cookieContainer = cookies;

            string appURL = "http://login.yahoo.com/config/validate?.src=flickr&.pc=5134&.scrumb=6l14Ni2Pz3j&.pd=c%3DE0.GahOp2e4MjkX.5l2HgAoLkpmyPvccpVM-&.intl=us&.done=http%3A%2F%2Fwww.flickr.com%2Fsignin%2Fyahoo%2F%3Fredir%3D%252Fpeople%252F" + user + "%252Frelationship%252F";
            HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as HttpWebRequest;
            wrWebRequest.CookieContainer = cookieContainer;
            wrWebRequest.AllowAutoRedirect = false;
            HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();

            appURL = "http://flickr.com/signin/yahoo/?redir=%2Fpeople%2F" + user + "%2Frelationship%";
            HttpWebRequest wrWebRequest2 = WebRequest.Create(appURL) as HttpWebRequest;
            wrWebRequest2.CookieContainer = cookieContainer;
            wrWebRequest2.AllowAutoRedirect = false;
            HttpWebResponse hwrWebResponse2 = (HttpWebResponse)wrWebRequest2.GetResponse();

            appURL = "http://flickr.com/cookie_check.gne?pass=%2Fpeople%2F" + user + "%2Frelationship%2F&fail=register_cookies.gne";
            HttpWebRequest wrWebRequest3 = WebRequest.Create(appURL) as HttpWebRequest;
            wrWebRequest3.CookieContainer = cookieContainer;
            wrWebRequest3.AllowAutoRedirect = true;
            HttpWebResponse hwrWebResponse3 = (HttpWebResponse)wrWebRequest3.GetResponse();

            return cookieContainer;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:00:21+00:00Added an answer on May 13, 2026 at 2:00 pm

    I’ve done something similar with perl’s WWW:Mechanize library, look into that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Rewrote the question. Added bounty as its important for me. The final hint
EDIT : Accepted answer points out what my issue was. I added another answer
Edit: Added bounty because I'm seeking an MVC3 solution (if one exists) other than
EDIT: added code Also since the DateTimes are not really Datetimes (sTrings in hh:mm:ss
edit added a test with regexpr to solve the problem techfoobar pointed out edit
Edit: Added code (Exception on line 095, 5th time it's hit.) public DataTable ParseBarcodes(String[]
EDIT: I added in where I create new instance of the class Process as
EDIT I added this note to explain why I keep this question here. I
Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
I have a piece of code: EDIT: The _penParams are initialized as the added

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.