Revision: 44584
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 14, 2011 15:19 by kumar_sekhar
Initial Code
<?php define('POSTURL', 'http://youdomain.nl/filename.php'); define('POSTVARS', 'Aanhef=Mr&Voorletters=testVoorletters&Tussenvoegsel=tetsTussenvoegsel&Achternaam=testfname&Adres=111,ddd,NL&Huisnr=sfsfs&Huisnr_toevoeging=ggggg&Postcode=324234&[email protected]&dealer_id=111'); // POST VARIABLES TO BE SENT // INITIALIZE ALL VARS $Email=''; $ch=''; $Rec_Data=''; $Temp_Output=''; if($_SERVER['REQUEST_METHOD']==='POST') { // REQUIRE POST OR DIE if(isset($_POST['Email'])) $Email=$_POST['Email']; // GET EMAIL INTO VAR $ch = curl_init(POSTURL); curl_setopt($ch, CURLOPT_POST ,1); curl_setopt($ch, CURLOPT_POSTFIELDS ,POSTVARS.$Email); // curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS OF THE CALL $Rec_Data = curl_exec($ch); ob_start(); header("Content-Type: text/html"); $Temp_Output = ltrim(rtrim(trim(strip_tags(trim(preg_replace ( "/\s\s+/" , " " , html_entity_decode($Rec_Data)))),"\n\t\r\h\v\0 ")), "%20"); $Temp_Output = ereg_replace (' +', ' ', trim($Temp_Output)); $Temp_Output = ereg_replace("[\r\t\n]","",$Temp_Output); $Temp_Output = substr($Temp_Output,307,200); echo $Temp_Output; $Final_Out=ob_get_clean(); echo $Final_Out; curl_close($ch); } else die('Hacking attempt Logged!'); exit;
Initial URL
Initial Description
Simply define your POSTURL and POSTVARS in name = value string format. It will post the form.
Initial Title
Form Post using CURL in php
Initial Tags
form, curl, post
Initial Language
PHP