i tried with the function submit() to login to a site like http://www.kamikazegames.com/dominion/login.asp
but i havent figured out yet how to do this
help is greatly appreciated
For this particular site, the logon will look like this:
$ActionUrl = "http://www.kamikazegames.com/dominion/login2.asp?z=224102";
$FormVars = array("Username" => "your_username_here", "Password" => "your_password_here");
$snoopy = new Snoopy();
$snoopy->submit($ActionUrl, $FormVars, array());
More generaly, you can compose action urls using the private Snoopy method called _expandlinks, but with some limitations.
I wrote this piece of code to get the proper action URL:
// $action is the action specified in the form tag
// $url is the URL of the form page
// $ActionUrl is the resulting URL you can use to submit the form
if ($action == "")
$ActionUrl = $url;
// snoopy incorrectly handles "/" (root) action links
elseif (substr($action, 0, 1) == "/")
preg_match("/^(http:\/\/)?([^\/]+)/i", $url, $matches);
if ($matches != "http://")
$ActionUrl = "http://";
$ActionUrl .= $matches.$action;
$ActionUrl = $snoopy->_expandlinks($action, $url);
There are still some improvements needed. Firstly, not to hardcode the 'http:// ' protocol to the links, instead look at the $url protocol and use it.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.