Created
September 29, 2012 23:09
-
-
Save AlbertoMonteiro/3805395 to your computer and use it in GitHub Desktop.
Marquim!!!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Net; | |
namespace ConsoleApplication2 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CookieContainer cc; | |
var client = (HttpWebRequest) HttpWebRequest.Create(@"http://www.saoluizdelivery.com.br/ajaxpro/IKCLojaMaster.bemvindo,MercadinhoSaoLuiz.ashx"); | |
client.Method = "post"; | |
client.ContentLength = "{\"cep\":\"60020-270\"}".Length; | |
client.Referer = "http://www.saoluizdelivery.com.br/bemvindo.aspx"; | |
client.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4"; | |
client.Host = "www.saoluizdelivery.com.br"; | |
client.ContentType = "text/plain; charset=UTF-8"; | |
client.ContentType = "application/x-www-form-urlencoded"; | |
client.Headers.Add("X-Requested-With", "XMLHttpRequest"); | |
client.Headers.Add("X-AjaxPro-Method", "EntrarLoja"); | |
using (var stream = client.GetRequestStream()) | |
{ | |
using (var str = new StreamWriter(stream)) | |
{ | |
str.Write("{\"cep\":\"60020-270\"}"); | |
str.Close(); | |
} | |
stream.Close(); | |
} | |
client.CookieContainer = cc = new CookieContainer(); | |
WebResponse webResponse = null; | |
try | |
{ | |
webResponse = client.GetResponse(); | |
using (var str = new StreamReader(webResponse.GetResponseStream())) | |
{ | |
Console.WriteLine(str.ReadToEnd()); | |
} | |
} | |
catch (WebException e) | |
{ | |
using (var str = new StreamReader(webResponse.GetResponseStream())) | |
{ | |
Console.WriteLine(str.ReadToEnd()); | |
} | |
} | |
client = (HttpWebRequest)HttpWebRequest.Create(@"http://www.saoluizdelivery.com.br/"); | |
client.CookieContainer = cc; | |
webResponse = client.GetResponse(); | |
try | |
{ | |
webResponse = client.GetResponse(); | |
using (var str = new StreamReader(webResponse.GetResponseStream())) | |
{ | |
Console.WriteLine(str.ReadToEnd()); | |
} | |
} | |
catch (WebException e) | |
{ | |
using (var str = new StreamReader(webResponse.GetResponseStream())) | |
{ | |
Console.WriteLine(str.ReadToEnd()); | |
} | |
} | |
Console.Read(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require "uri" | |
uri = URI.parse("http://www.saoluizdelivery.com.br/ajaxpro/IKCLojaMaster.bemvindo,MercadinhoSaoLuiz.ashx") | |
# Full control | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.set_form_data({"cep" => "60020-270"}) | |
request.add_field "X-AjaxPro-Method" , "EntrarLoja" | |
response = http.request(request) | |
puts request.method | |
#for f in response.msg | |
puts response.get_fields('set-cookie') | |
#end | |
#h1 = open("http://www.saoluizdelivery.com.br/ajaxpro/IKCLojaMaster.bemvindo,MercadinhoSaoLuiz.ashx") | |
#Clipboard.copy h1.meta["set-cookie"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment