Login   Register  
PHP Classes
elePHPant
Icontem

File: example_1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Nashruddin Amin  >  Hacker's HTTP Client  >  example_1.php  >  Download  
File: example_1.php
Role: Example script
Content type: text/plain
Description: Send mail using GMail web application
Class: Hacker's HTTP Client
Automate retrieval and processing of Web pages
Author: By
Last change:
Date: 5 years ago
Size: 1,062 bytes
 

Contents

Class file image Download
<?php
/**
 * This script will send email using GMail's web application
 * It's the basic of the more sophisticated free newsletter system
 *
 * See more examples at http://php-http.com/examples
 */

include 'phpWebHacks.php';

$h = new phpWebHacks;

/* open gmail.com */
$h->get('http://gmail.com');

/* extract the hidden fields of the login form */
$form $h->parseForm('gaia_loginform', &$action);

/* username & password */
$form['Email']  = 'black_hawk_down';
$form['Passwd'] = 'mysecretpass';

/* login */
$h->post($action$form);

/* go to the 'compose' page */
$h->get('?v=b&pv=tl&cs=b');

/* extract hidden fields of the compose form */
$form $h->parseForm('f', &$action);

/* write message */
$form['to']          = 'dede_blackheart@hotmail.com';
$form['subject']     = 'phpWebHacks rocks!';
$form['body']        = 'Yeah it rocks!';
$form['nvp_bu_send'] = 'Send';

/* browse attachment */
$file = array(
    
'file0' => '/home/nash/najwa.jpg'
);

/* click send button */
$h->post($action$form$file);
?>