PHP and cURL
I am trying to make a program that will log me into enigmagroup.org. I am using php and cURL. The thing is though it isn't working. I get to errors when I try to use it. cURl is installed on the server. Here is my code.
**<?php
$ch = curl_init();
$ip="70.176.49.197";
$user="knutrainer";
$passwrd="some pass";
$url="http://www.enigmagroup.org";
curl_setopt($ch, curlopt_url, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $user&$passwrd);
?> **
Thanks for the help weather it is critical or not.
$username = 'knutrainer';
$password = '';
$cURL = curl_init( 'http://www.enigmagroup.org' );
curl_setopt($cURL, CURLOPT_HEADER, FALSE);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL, CURLOPT_POSTFIELDS, "$username&$password");
$response = curl_exec( $cURL );
curl_close( $cURL );
echo $response;
?>```
Try those (directly from my bookmarks)
http://www.zend.com/pecl/tutorials/curl.php#Heading6 http://curl.planetmirror.com/docs/httpscripting.html http://www.higherpass.com/php/Tutorials/Using-Curl-To-Query-Remote-Servers/ http://php.ru.ac.za/manual/en/ref.curl.php http://www.programmershelp.co.uk/phpandcurl.php http://www.hudzilla.org/phpbook/read.php/15_10_0
A really good book – if you have some money to spare: http://curl.phptrack.com/get_page.php?fuseaction=downloads
As soon as you log in you are redirected, personally I'd do something like this:
<?php
$username = 'Mals';
$password = 'example';
$url= "http://www.enigmagroup.org/forums/index.php?action=login2";
$post_vars = "&user=$username&passwrd=$password&cookielength=-1";
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_POST, 1);
curl_setopt($cURL, CURLOPT_HEADER, FALSE);
curl_setopt($cURL, CURLOPT_REFERER, 'http://www.enigmagroup.org/index.php?page=main');
curl_setopt($cURL, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $post_vars);
curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, 1);
$response = curl_exec($cURL);
curl_close($cURL);
echo $response;
?>
.|Mals