0

PHP curl can't simulate the login information on this website, http://livearchive.onlinejudge.org/, and it return a sentence ,You are not authorized to view this page!

  • I don't think that curl isn't able to do something that you are able to do manually by using a web browser. – matthias.p Aug 18 '12 at 11:51
  • What have you tried? Do you expect somedy to programm this for you? SO is not that type of community. – mintobit Aug 18 '12 at 11:56

2 Answers2

2

cURL should be able to simulate the login just fine.

Make sure you:

  • POST the data to the login URL.
  • Fetch the login page to get the correct nonce data and such.
  • Store the cookie afterwards and use it for further requests

How to POST data

See answer to the the question Passing $_POST values with cURL

How to fetch the proper form data

Use a HTML parser library to parse the webpage and extract the fields. You could for instance use DOMDocument, and use getElementById to get the form you desire.

How to store the cookie and use it for further requests

This is explained on the page PHP cURL and cookies.

Community
  • 1
  • 1
Sebastian Paaske Tørholm
  • 49,493
  • 11
  • 100
  • 118
0

Since its just a question i would expect you also need an explanation and not any script.

Curl can Login perfectly to the site you mention but you need to get your parameters right.

Your URL should be pointed to : http://livearchive.onlinejudge.org/index.php?option=com_comprofiler&task=login and with the following variables

username=
passwd= 
op2=login
lang=english
force_session=1
return=B%3AaHR0cDovL2xpdmVhcmNoaXZlLm9ubGluZWp1ZGdlLm9yZy8%3D
message=0
loginfrom=loginmodule
cbsecuritym3=cbm_02099e1c_6e2810f8_97a3f622ba6c000cb557bd8458534f61&j2ffb0ca892d8cf58942dfbea23559ed2=1
remember=yes
Submit=Login

Please take note of cbsecuritym3 variable and you also need to send 2 Cookie information that look eg. mosvisitor=1; 8ca25fe06780267eef1b49296a9a99ce=249baaaba68197c9b1681e57d69c3193

If all this are properly sent you would be able to login

Baba
  • 94,024
  • 28
  • 166
  • 217