Jump to content

[SOLVED] Auto Fill Forms?


onenonly

Recommended Posts

using post fields..

something like this (untested)

$URL = "http://example.com";
$POSTFIELDS = 'field1=111&field2=222';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

$result = curl_exec ($ch);
curl_close ($ch); 
print 	$result;	

 

See CURL manual for full details

Link to comment
Share on other sites

opps so sorry but im very thankful but i kinda found it myself  ;D

i didnt understand what u meant

 

<?php

/*************************************
Copyright 2007 WageRank
http://www.wagerank.com
*************************************/

$username="YOURUSERNAMEGOESHERE";
$password="YOURPASSWORDGOESHERE";


//No need to edit below this line



//This is the info I pulled out of the LiveHTTPHeaderWindow
$loginURL = "http://technorati.com/login.php";
$loginFields = "username=$username&password=$password";

//Now we just submit the form to login
hitForm($loginURL, $loginFields);

//Here we add WageRank to our favorites
$favoritesURL = "http://technorati.com/faves/$username";
$favoritesFields = "add=http%3A%2F%2Fwww.wagerank.com&tag=%22online+marketing%22+seo+sem+%22affiliate+marketing%22";
hitForm($favoritesURL, $favoritesFields, "http://technorati.com/faves/$username?add=http://www.wagerank.com");

//Now we load our list of favorites and display it.
print hitPage("http://technorati.com/faves/$username");

//That's it! Below are the two function definitions we used.

function hitPage($page) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
        curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
        curl_setopt($ch, CURLOPT_URL, $page);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $ret = curl_exec($ch);
        curl_close($ch);
        return $ret;
}


function hitForm($loginURL, $loginFields, $referer="") {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
        curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
        curl_setopt($ch, CURLOPT_URL, $loginURL);
        curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $loginFields);
        $ret = curl_exec($ch);
        curl_close($ch);
        return $ret;
}


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.