1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What variables should I post to get a result?

Discussion in 'PHP & Perl' started by lanbo, Apr 16, 2012.

  1. lanbo

    lanbo Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 23, 2009
    Messages:
    3,508
    Likes Received:
    608
    Home Page:
    I'm trying to post a keyword to spyfu:
    http://www.spyfu.com/

    Basically when i search for a keyword, it'll redirect me to a link like this:
    http://www.spyfu.com/Term.aspx?t=667453

    I don't know how they're generating that number, so that means I have to submit a POST request everytime.

    <input name="Search1$SearchTextBox" type="text" id="Search1_SearchTextBox" autocomplete="off" tabindex="1" size="50" class="MainSearchInputBox" />
    I tried to post "Search1_SearchTextBox" to return their "spyfu classic" results but it didn't work.

    Anyone have any ideas on this?

    -Lanbo
     
  2. Mutikasa

    Mutikasa Power Member

    Joined:
    May 23, 2011
    Messages:
    579
    Likes Received:
    207
    Search1$SearchTextBox or Search1_SearchTextBox?
     
  3. kill4

    kill4 Regular Member

    Joined:
    May 11, 2009
    Messages:
    254
    Likes Received:
    42
    Gender:
    Male
    Location:
    Texas
    I just looked at it at through fiddler, did a search for a keyword. The keyword post request looked like this..

    Code:
    POST http://www.spyfu.com/Default.aspx HTTP/1.1
    Host: www.spyfu.com
    User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:11.0) Gecko/20100101 Firefox/11.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Referer: http://www.spyfu.com/
    Cookie: ASP.NET_SessionId=iz4tryimvp5zp145iimbxdnd; __gads=ID=d269cb5ffee97736:T=1334787945:S=ALNI_MbCkAlCKExRRNlkJs0cNcPip5fghA; __utma=162630398.551395931.1334787943.1334787943.1334787943.1; __utmb=162630398.3.10.1334787945; __utmc=162630398; __utmz=162630398.1334787945.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmv=162630398.|1=IsLogg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0tleV9fFgIFFVNlYXJjaDEkdG9wbmF2X3NlYXJjaAULYnRuQ29udGludWXhuZyi0QHUVeNjjqQ9mvKXvLcxJQ%3D%3D&__EVENTTARGET=&__EVENTARGUMENT=&__EVENTVALIDATION=%2FwEWBAKv0IX%2FAgLp0NOPCQLdh7%2BKDgKYm8bUB6HN5RIgcHkEpMU%2FWJDLz6gFsbN5&Search1%24SearchTextBox=low&Search1%24topnav_search.x=30&Search1%24topnav_search.y=16
    
    
    So you would need to do a post to "http://www.spyfu.com/Default.aspx" then the post content has the __VIEWSTATE variable you could parse that in the source, but idk if its necessary maybe you could bypass it?

    There are some other variables that are in the post content these are "Search1%24topnav_search.x=30&Search1%24topnav_search.y=16" im guessing those can stay the way they are.. Anyway the variable that holds the keyword in the post content is this "Search1%24SearchTextBox=low" low was the keyword i searched for.

    Once i issued that request. This was the response i got back.

    Code:
    
    HTTP/1.1 302 Found
    Date: Wed, 18 Apr 2012 22:34:20 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    X-AspNet-Version: 2.0.50727
    Location: /Term.aspx?t=1801116
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Content-Length: 143
    
    <html><head><title>Object moved</title></head><body>
    <h2>Object moved to <a href="%2fTerm.aspx%3ft%3d1801116">here</a>.</h2>
    </body></html>
    
    Got a 302 Found response with the body content above. This is what your looking for <a href="%2fTerm.aspx%3ft%3d1801116"> Notice the "1801116" thats the generated number you want, after that you would go here http://www.spyfu.com/Term.aspx?t=1801116 and there's your results!

    I'm pretty sure this works. I put together the raw request in fiddler with different keywords, and got different numbers back with each keyword, and following each http://www.spyfu.com/Term.aspx?t=NEW-NUMBER url gave back the new results for each keyword.