Logicalgamers Posted April 25, 2008 Share Posted April 25, 2008 I have two variables. $URL and $StrPost. I was to send a POST HTTPRequest to $URL with post data set at $StrPost. The catch is though, the post data is very long. Two variables are below. $URL="http://tektek.org/gaia/worth.php"; $strPost='environment=0&txt=xtitle%3D%22%22+width%3D%22474%22+height%3D%224%22+%2F%3E%3C%2Ftd%3E%0D%0A%09%09%09%09+++++++++++++xtitle%3D%22Stethoscope%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Happy+Ghost+Sheet%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Polo%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Khaki+Shorts%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Sandals%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Table%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Bed%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Chair%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Plant%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Light%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Rug%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Door%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Window%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Fridge%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Punk+Starter+Top%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Baggy+Starter+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Sporty+Starter+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Dress+Starter+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Punk+Starter+Pants%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Baggy+Starter+Pants%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Sporty+Starter+Shorts%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Dress+Starter+Slacks%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Boots%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Hip+Starter+Sneakers%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Dress+Starter+Shoes%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Sporty+Starter+Sneakers%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Basic+Fishing+Rod%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Morganas+Gloves%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Green+Flame+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Ticket%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%&=Calculate+Your+Worth'; Now, I know for a fact that the post data works. I used the exact same post data and URL in Visual Basic and I achieved the correct return; however, there is nothing I can do in PHP to get the right return... I keep getting errors. Would pay for a solution Whoever manages to fix first (or write a short script for me ) I'll send $30 or so through Paypal. Cheers. Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted April 25, 2008 Share Posted April 25, 2008 There is a lot more to creating a HTTP post script then the url and post data. Could we see the code that you use to send the post request? Are you sure the the code the receives the post request 'http://tektek.org/gaia/worth.php' is working correctly? Quote Link to comment Share on other sites More sharing options...
Spaceman-Spiff Posted April 25, 2008 Share Posted April 25, 2008 You can do a simple test inside worth.php: if (empty($_POST['strpost'])) echo 'No strpost value found'; else echo htmlspecialchars($_POST['strpost']); And make sure your form has the correct action, method and field names. Quote Link to comment Share on other sites More sharing options...
Logicalgamers Posted April 26, 2008 Author Share Posted April 26, 2008 As soon as the post data exceeds 1024 characters it throws out an error. Does anybody know why that is? This is my code: <?php $URL="http://www.tektek.org/gaia/worth.php"; $strPost='environment=0&txt=xtitle%3D%22%22+width%3D%22474%22+height%3D%224%22+%2F%3E%3C%2Ftd%3E%0D%0A%09%09%09%09+++++++++++++xtitle%3D%22Stethoscope%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Happy+Ghost+Sheet%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Polo%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Khaki+Shorts%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Sandals%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Table%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Bed%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Chair%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Plant%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Light%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Rug%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Door%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Window%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Fridge%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Punk+Starter+Top%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Baggy+Starter+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Sporty+Starter+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Dress+Starter+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Punk+Starter+Pants%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Baggy+Starter+Pants%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Sporty+Starter+Shorts%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Dress+Starter+Slacks%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Starter+Boots%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Hip+Starter+Sneakers%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Dress+Starter+Shoes%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Neutral+Sporty+Starter+Sneakers%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Basic+Fishing+Rod%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Morganas+Gloves%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Green+Flame+Shirt%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%22Ticket%22%3E%3Cimg+style%3D%22cursor%3A+hand%22+alt%3D%22xtitle%3D%&=Calculate+Your+Worth'; $strPost=htmlspecialchars($strPost); $strHTML = HTTP_POST($URL,$strPost,$URL); die($strHTML); function HTTP_Post($url,$post,$ref) { global $CookieName; $aheader = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_REFERER, $ref); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.