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

curl-and-php

Squirrel mail login script

From: Russell Snella <rsnella_at_ajrintl.com>
Date: Tue, 27 Feb 2007 15:11:18 -0600

I am trying to log into squirrel mail with the rework of this script. The
original script works to log in to ebay. My problem is that I need to get
this script to work. The script dose not seem to login. Can anyone help me
fix this script?

<?php
/*
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
' File: ebay_login.php
'
' Description: This script Login you on Ebay.com website using
curl in php.
'
' Written by: Imran Khalid imranlink_at_hotmail.com
'
' Languages: PHP + CURL
'
' Date Written: March 23, 2004
'
' Version: V.1.0
'
' Platform: Windows 2000 / IIS / Netscape 7.1
'
' Copyright: Open Sorce Code (GPL)
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
*/

// 1-Get First Login Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn
// This page will set some cookies and we will use them for Posting in Form
data.

        $ebay_user_id = "barbara"; // Please set your Ebay ID
        $ebay_user_password = "fred"; // Please set your Ebay Password
        $cookie_file_path = "crawler\vis_login\cook"; // Please set your
Cookie File path
        
        $LOGINURL = "http://webmail.foobar.com/src/login.php";
        $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,$LOGINURL);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
    $result = curl_exec ($ch);
    curl_close ($ch);

// 2- Post Login Data to Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll

        $LOGINURL = "http://webmail.foobar.com/src/login.php";
        $POSTFIELDS = 'login_username='. $ebay_user_id .'&secretkey='.
$ebay_user_password.'&js_autodetect_results=0&just_logged_in=1&submit=Login'
;
    $reffer = "/redirect.php";
echo $POSTFIELDS;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
    curl_setopt($ch, CURLOPT_URL,$LOGINURL);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_REFERER, $reffer);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
    $result = curl_exec ($ch);
    curl_close ($ch);
        print $result;

?>

 
Ajr Intl. Inc
Russell R. Snella
 

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-02-27