Jump to content

Using CURL to submit files


PyraX

Recommended Posts

Hi,

 

Im looking for a solution for that will allow me to submit a form on a remote website that will send a file. The only think i know of that can do this is curl.

 

I also need to grab the randomised image from the first site and submit the verification text.

 

Thanks in advance.

 

PyraX

Link to comment
Share on other sites

captcha code:

<?php

/*********** POST DATA USING CURL **************/
//parameters for posting data
$data = array('var1' => 5,"var2"=>10);

// CURL Session initialization
$ch = curl_init();

//CURL Option settings
curl_setopt($ch, CURLOPT_URL,'http://localhost:9000/test/curl/post_action.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//execution and posting data
$res=curl_exec($ch);
/*********** CAPTCHA CODE **************/
$str = "";
$length = 0;
for ($i = 0; $i < 4; $i++) {
$str .= chr(rand(97, 122));
}
$imgX = 60;
$imgY = 20;
$image = imagecreatetruecolor(60, 20);

$backgr_col = imagecolorallocate($image, 238,239,239);
$border_col = imagecolorallocate($image, 208,208,208);
$text_col = imagecolorallocate($image, 46,60,31);

imagefilledrectangle($image, 0, 0, 60, 20, $backgr_col);
imagerectangle($image, 0, 0, 59, 19, $border_col);

$font = "VeraSe.ttf"; // it's a Bitstream font check www.gnome.org for more
$font_size = 10;
$angle = 0;
$box = imagettfbbox($font_size, $angle, $font, $_SESSION['rand_code']);
$x = (int)($imgX - $box[4]) / 2;
$y = (int)($imgY - $box[5]) / 2;
//imagettftext($image, $font_size, $angle, $x, $y, $text_col, $font, $_SESSION['rand_code']);
imagettftext($image, $font_size, $angle, $x, $y, $text_col, $font, $str);

header("Content-type: image/png");
imagepng($image);
imagedestroy ($image);
?>

 

Regards,

Vijay

 

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.