Linked Questions

Popular Questions

There is a website that I need to buy items from. Basically I have to go through 3 steps to buy the item:

  1. Login
  2. Add item to cart
  3. Fill details and checkout

I am trying to do that using CURL or HTTPWEBREQUESTS but it does not want to work. The steps that I used to make it work which didn't:

  1. Created a POST request with CURL to the login link with the POST Data [Username and password]
  2. Added item to cart using CURL also
  3. Checked out using CURL

Anyway all that didn't work. So is there any steps or consideration should I take? Also I wanted to read the HTTP Response from CURL to read the source code and see where am I stuck at.

Anyway here is my CURL Request code, it may help:

    static private void POST_DATA(string url, string data)

        Easy e = new Easy();
        Easy.WriteFunction wf = MyWriteFunction;

        string[] header = { "HTTP/1.1 200 OK Date: Tue, 06 Mar 2012 22:28:24 GMT Server: Apache Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: PHPSESSID=cq1viovgm2nvov3ovdftsfjg67; path=/ Vary: Accept-Encoding Cache-Control: max-age=600, private, must-revalidate Content-Length: 14161 Content-Type: text/html; charset=UTF-8", "content-type plain/text" };

        e.SetOpt(CURLoption.CURLOPT_HEADER, true);
        e.SetOpt(CURLoption.CURLOPT_HTTPHEADER, header);
        e.SetOpt(CURLoption.CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11");
        e.SetOpt(CURLoption.CURLOPT_URL, url);
        e.SetOpt(CURLoption.CURLOPT_POSTFIELDS, data);
        e.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

Related Questions