Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

c# http post problem

Name: Anonymous 2007-04-13 10:23 ID:+IKYbSzl

/prog/, I have a problem.  I am trying to scrape store locations of walgreens for a client. Don't ask, I'm just doing shit to get paid.  Problem is, this form sucks.  I get the post data, populate it with what is needed, post it, and get the search form as a result instead of store locations.

I know the post data is correct.  I used a program I found on a programming site that has a webbrowser control, http request data, http post data and http response data.  I used the webbrowser control to navigate to the site, peform a store location search, and get results.  The data url and postdata found in the below code was taken directly from this program after the search.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Net;
using System.IO;

namespace FuckThisShit
{
    class YouBetterWorkFucker
    {
        static void Main(string[] args)
        {
            string url = "http://www.walgreens.com/storelocator/result.jsp?_DARGS=/storelocator/find_fg.jsp";;
            string postData ="_dyncharset=ASCII&address=&_D%3Aaddress=+&city=&_D%3Acity=+&_D%3A%2Fstorelocator%2FWalgreensLocator.state=+&%2Fstorelocator%2FWalgreensLocator.state=&zip=48186&_D%3Azip=+&_D%3A%2Fstorelocator%2FWalgreensLocator.searchList=+&_D%3Aradius=+&radius=5&_D%3A%2Fstorelocator%2FWalgreensLocator.searchList=+&_D%3A%2Fstorelocator%2FWalgreensLocator.searchList=+&_D%3A%2Fstorelocator%2FWalgreensLocator.fluInd=+&_D%3A%2Fstorelocator%2FWalgreensLocator.getMap=+&%2Fstorelocator%2FWalgreensLocator.getMap=10&_D%3A%2Fstorelocator%2FWalgreensLocator.getMap=+&_DARGS=%2Fstorelocator%2Ffind_fg.jsp&%2Fstorelocator%2FWalgreensLocator.getMap.x=74&%2Fstorelocator%2FWalgreensLocator.getMap.y=13";
           
            System.Console.WriteLine("Starting post...");
           
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            req.UserAgent = "Mozilla/4.0";
            req.ProtocolVersion = HttpVersion.Version10;
            req.ContentType = "application/x-www-form-urlencoded";
            req.Method = "POST";
            req.KeepAlive = false;

            byte[] bytes = System.Text.Encoding.ASCII.GetBytes( postData);
            req.ContentLength = bytes.Length;

            System.Console.WriteLine("Posting data...");

            Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();

            WebResponse resp = req.GetResponse();
            StreamReader sr = new StreamReader(resp.GetResponseStream());

            System.Console.WriteLine("Reading results data...");

            StreamWriter sw = new StreamWriter("results.txt");
            sw.Write(sr.ReadToEnd().Trim());
            sw.Close();
           
            System.Console.WriteLine("Done.");
        }
    }
}


It's my first time, be gentle.

Name: Anonymous 2007-04-13 10:29 ID:+IKYbSzl

Two semi-colons you POS

Go back to QBASIC.

Name: Anonymous 2007-04-13 10:47 ID:+IKYbSzl

I knew someone would say that after I noticed it :(

Name: Anonymous 2007-04-13 10:48 ID:+IKYbSzl

Paul is not a meme.

Name: Anonymous 2007-04-13 13:38 ID:+gQoOVM/

>>2
More like OCAML

Name: Anonymous 2007-04-14 4:08 ID:z4IdnQN4

It's my first time, be gentle.

Was it as good for you as it was for me?

Name: Anonymous 2007-04-14 4:23 ID:AHKpK4ly

>>6
Probably not, since C# is a jaded slut.

Name: Anonymous 2007-04-14 9:59 ID:gD9Wx459

C# has centipedes in it's vagina.

Name: Anonymous 2007-04-14 12:08 ID:fj3mvS13

>>8
its more likely than you think™

Name: Anonymous 2007-04-14 18:51 ID:/1L6bqID

Stop using C#. If you absolutely pretty really must do .NET, consider IronPython or F#.

Name: ​​​​​​​​​​ 2010-10-24 22:18

Name: Anonymous 2010-11-14 5:31

Name: Anonymous 2010-12-26 12:14

Name: Sgt.Kabuꤡ❜kiman뢋 2012-05-29 0:13

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List