_Post Problems

I made a custom script to assist me in a game I play, but I ran into a curious error that I honestly cant find a solution to.
To help in the game I collected variables from different areas across it, I’m new to php and started learning it 2 weeks ago, I’ve created a database that holds Account Name/Account ID#/Power that loads to a list, created a script to login to the game, then curl back through a loop using a cookie.txt file with a session id that grabs captchas from recaptcha on the accounts and posts them in iframes, for users to submit.
That section all works fine, but the site I’m connecting to uses the _POST http header to input the data when your on a browser, so i attempted to use _POST to input it back into the game (the completed captcha) to join the accounts, when I did this I received error
The requested resource
/joinraid.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
I went back and double checked the http headers and that the information I’m inputting match’s the information the browser relays exactly. I tryed activating SSL’s and increasing the POST data length on my server, aswell as editing the keep alive timeout and trying every other fix I could find on google. I checked the encoding and char set, to make sure it matched the header as well, so I’m wondering if the problem is in my code.

[php]

<?php include("connect.php"); $cookie = 'temp/cookierb.txt'; //send join raid curl if (isset($_POST['submit'])) { $ch = curl_init(); for ($i = 0; $i < 5; $i++) { //ADD CHECK IF VARIABLE ACTUALLY SET? DECREASES TIME ON CURL POSTS... //echo 'length'.$i.', '.$_POST['suid'.$i.''].': '.strlen($_POST['suid'.$i.'']) .'
'; if (strlen($_POST['suid'.$i.''])>0) { unlink($_POST["path".$i]); $opt1 = 'http://'.$server.'.outwar.com/joinraid.php?raidid='.$_POST['raidid'].'&suid='.$_POST['suid'.$i.''].'&serverid='.$serverid; $opt2 = 'recaptcha_challenge_field='.$_POST['recaptcha_challenge_field'.$i.''].'&recaptcha_response_field='.$_POST['recaptcha_response_field'.$i.''].'&codeid='.$_POST['codeid'.$i.''].'&submit=Launch!'; //echo 'opt1: '.$opt1.', opt2: '.$opt2.'
'; curl_setopt ($ch, CURLOPT_URL, $opt1); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $opt2); curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_HEADER, 0); $resultt = curl_exec($ch); } } curl_close ($ch); [/php]

my first stab at this would be to edit the php.ini file and increase the memory_limit and post_max_size

At your request I tried with:
memory_limit 4096M
post_max_size 4096M
and still received the same error

I’m curious if it has to do with how the website I’m connecting to receives data?

now that you mention it, you are cURl ing the data to another server and it is responding to you “the request resource is…,.” I am thinking that you would have to be right that it has to do with their server not accepting that much info.
See what is all being sent in your cURL post data to see how big that request is, if it needs it try breaking the post data up into smaller pieces with multiple queries and see how that works. since increasing your post data size limits to an unimaginable amount for cURLng post data, I am fairly certain that you are not posting that much data, unless you are sending some pictures or movies or something :smiley:

You may want to look at POST encoding types
such as urlencoded

curl_setopt( $ch, CURLOPT_HTTPHEADER, Array( 'Content-Type: application/x-www-form-urlencoded' ) );
Sponsor our Newsletter | Privacy Policy | Terms of Service