cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

post login

From: Ryan Houseman <housemanyoung_at_yahoo.com>
Date: Mon, 14 Apr 2008 00:13:37 -0700 (PDT)

im looking to create an automated login as practice on my favorite online game
  but i can't seem to get the script to read right.
   
  here's what i have:
   
  <?php
   
$url = "www.poxnora.com";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
  curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username=dummyacct&password=default');
  $result = curl_exec ($ch);
curl_close ($ch);
  print $result;

?>
</body>
</html>
   
  i've tried going through some tutorials online, but just can't seem to progam it. the script seems to stop however, as all the normal graphics don't load with just getting the website (no posting).
  also tried as a post fields:
   
  fwdURL=http%3A%2F%2Fwww.poxnora.com%2Findex.do&username=dummyacct&password=default&x=21&y=15
   
  &username=dummyacct&password=default&x=21&y=15
   
  i have live headers which gives me as the 1st paragraph:
   
  http://www.poxnora.com/security/dologin.do
  POST /security/dologin.do HTTP/1.1
Host: www.poxnora.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.poxnora.com/index.do
Cookie: JSESSIONID=3C648DC0FB055C4CDDD4CD4CA0E01DC0; JSESSIONID=3C648DC0FB055C4CDDD4CD4CA0E01DC0
Content-Type: application/x-www-form-urlencoded
Content-Length: 91
fwdURL=http%3A%2F%2Fwww.poxnora.com%2Findex.do&username=dummyacct&password=default&x=21&y=15
HTTP/1.x 302 Moved Temporarily
Date: Mon, 14 Apr 2008 04:35:10 GMT
Location: http://www.poxnora.com/index.do
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Keep-Alive: timeout=15, max=88
Connection: Keep-Alive

  any help or explanation would be greatly appreciated.

        

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-04-14