View Single Post
  #3 (permalink)  
Old 12-12-2005, 02:25 PM
oomwrtu oomwrtu is offline
WebProWorld Member
 

Join Date: Jul 2003
Posts: 86
oomwrtu RepRank 0
Default

cURL (command line or via PHP). Simple as that :D. It's a bit difficult to find resources on it, so if you need help using it let me know. It allows you to request a page exactly as if the server was a regular user. You can set things like cookie storage location, user-agent, and GET and POST (what you would be looking for to login) info. The result can be returned as a variable, allowing you to do w/e parsing you need to do to it. If you can't find a sample, let me know and I can work with you, cURL has been a life-saver for me, lol.

EDIT: You beat me to it, I will look at your code and see what I can see...

EDIT2: Try this and see how it works, obviously I am unable to try it myself :D. If there is something wrong with it and you can't figure it out, I will be back tonight and I can see what I can do again.
Code:
<?php

// login and store cookie data
$cookielocation = "socomcookies.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookielocation);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookielocation);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$url = "https://socom3html-prod.svo.pdonline.scea.com:10079/SOCOM3_HTML/account/Account_Login_Submit.jsp";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "userName=" . $usernamehere . "&passWord=" . $passwordhere);
$result = curl_exec($ch);

// get actual data
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookielocation);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookielocation);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$url = "http://socom3html-prod.svo.pdonline.scea.com:10070/SOCOM3_HTML/stats/Stats_CareerSearch_Submit.jsp?userName=" . $usernamehere . "&gameMode=0";
curl_setopt($ch, CURLOPT_URL, $url);
$result = explode("\n", curl_exec($ch) );
curl_close($ch); 

// can parse here, currently ouputing each line
foreach( $result as $currline ) { echo $currline . "\n"; }

?>
__________________
Help Matt With College

Help a deserving student pay off his college loans!
Reply With Quote