0

I've looked for how to use cURL with PHP but in all the examples, it asks for post information. In the destination site which I want to login, it has these headers. Is there any way to login with cURL to this site?

POST //Login.aspx?t=tAagdOpCKVbBZJICqxicOwGO3g5%2fDqQ9HvthBEckSU%2fRd5lEPDasJELARgr2txnB12tfPnVvJSF1BasxQhlzbQ%3d%3d HTTP/1.1 Host: awebsite.com Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4 Content-Type: application/x-www-form-urlencoded Cookie: __qca=P0-1236052332-1411314388865; ASP.NET_SessionId=2lhdwlfafvc4mrt1leqofp4p; __utma=219632280.2029473779.1403506413.1419763928.1419764926.556; __utmc=219632280; __utmz=219632280.1419764926.556.7.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __utma=94244052.918496071.1403626522.1419678978.1419763934.203; __utmb=94244052.500.10.1419763934; __utmc=94244052; __utmz=94244052.1419763934.203.181.utmcsr=awebsite.com|utmccn=(referral)|utmcmd=referral|utmcct=/ Origin: http://awebsite.com Referer: http://awebsite.com/Default.aspx User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36

Guney Cobanoglu
  • 733
  • 1
  • 6
  • 20
  • 1
    @KevinBrown, unfortunately no. As you can see in the headers, there are no username and password field for sending. Only "t" and some encoded things. – Guney Cobanoglu Feb 06 '15 at 23:30
  • can you please copy each header line on one line please, it's hard to read.. – Mubin Feb 06 '15 at 23:34

1 Answers1

3

Your URL is: http://awebsite.com/Login.aspx?t=tAagdOpCKVbBZJICqxicOwGO3g5%2fDqQ9HvthBEckSU%2fRd5lEPDasJELARgr2txnB12tfPnVvJSF1BasxQhlzbQ%3d%3d

There is no post data. There are cookies and a content-type. Some APIs I've used reject the request if the content type is not x-www-form-urlencoded, but those google analysis cookies are likely unnecessary.

Check out the cURL doc of the setopt function. http://php.net/manual/de/function.curl-setopt.php

If you try to test the request you can also use curl from the bash.

Aitch
  • 1,617
  • 13
  • 24
  • Isn't "t" variable on the link is a post data? I'm trying to understand it but haven't figured out yet. – Guney Cobanoglu Feb 06 '15 at 23:44
  • No, it's also the query string, because the POST starts after the blank line, like: POST /anypath?with&any=param HTTP/1.1 Host: host.com Content-Type: application/x-www-form-urlencoded Content-Length: 24 postBegins=here&isUrlencoded=true – Aitch Feb 06 '15 at 23:55