Dear,
I want to write a programe(web crawler) that will open a website(yahoomail.com) and will put user name and pasword in the textboxes
and if the user is authenticated the crawler will fetch the data of website.
Any idea will be appriciated...
thanx
Loading
Ali ZaidiPosted Dec 14, 2010, 5:45 AM
The code is looking pretty fine but i am not aware eith php
Please can you send me the example in C#, or vb.net.....
CrishPosted Dec 14, 2010, 4:31 AM
You can refer this below code to solve the issue of Fetch data from website with userid and password.
Example:
function insert_meta($metaname,$metavalue) {
$user = array(
'meta_name' => $metaname,
'meta_value' => $metavalue
);
$this->db->insert('tusermeta', $user);
}[/sourcecode]
Don't forget to create your database and make sure it's connected with your CodeIgniter. Create a table :
[sourcecode language='sql'] CREATE TABLE `usermeta` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`meta_name` VARCHAR( 255 ) NOT NULL ,
`meta_value` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM[/sourcecode]
4. Create a controller to handle the data, for example:
I create a social.php inmy Controllers, I add a function to send data OAuth and get the session data.
[sourcecode language='php']
class social extends Controller {
function social() {
parent::Controller();
}
function twitconnect() {
// Fill in your twitter oauth client keys here
$consumer_key = 'YOUR-CONSUMER-KEY';
$consumer_key_secret = 'YOUR-CONSUMER-KEY-SECRET';
$this->load->library('session');
$tokens['access_token'] = NULL;
$tokens['access_token_secret'] = NULL;
$meta_name = NULL;
// GET THE ACCESS TOKENS
$this->load->library('twitter');
$auth = $this->twitter->oauth($consumer_key, $consumer_key_secret, $tokens['access_token'], $tokens['access_token_secret']);
if (isset($auth['access_token']) && isset($auth['access_token_secret'])) {
// SAVE THE ACCESS TOKENS
$this->load->model('musermeta');
$this->musermeta->insert_meta('twitter_access_token', $auth['access_token']);
$this->musermeta->insert_meta('twitter_access_token_secret', $auth['access_token_secret']);
echo 'Data saved';
if (isset($_GET['oauth_token'])) {
$uri = $_SERVER['REQUEST_URI'];
$parts = explode('?', $uri);
// Now we redirect the user since we've saved their stuff!
header('Location: ' . $parts[0]);return;
}
Or you can go for this site to get more detail.
http://www.socialblogr.com/2010/07/how-to-create-twitter-connect-and-save-sessions-to-database-on-codeigniter.html