I've got this cURL script that works on my host but not on my localhost.

$postData = 'user='.$user.'&paswoord='.$pass;

$getTable= curl_init();
curl_setopt($getTable, CURLOPT_URL, $infoweblink);
curl_setopt($getTable, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($getTable, CURLOPT_COOKIEFILE, 'cookie.txt'); 
curl_setopt($getTable, CURLOPT_ENCODING, 'gzip');        
curl_setopt($getTable, CURLOPT_HEADER, false);
curl_setopt($getTable, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($getTable, CURLOPT_POST, true);
curl_setopt($getTable, CURLOPT_POSTFIELDS, $postData);
$tableData = curl_exec($getTable);
curl_close($getTable);

Thats all! Just 2 get variables in the post data. And I receive this error:

Request Entity Too Large
The requested resource (site)
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.

I hope that someone can help me. Also I am not sure about if this is the correct site for this question. And is it possible that the server prevents me (my IP) from sending post data?

Edit: withouth the postfields and the post option, it does get the site. So the probplem probalby has t do something with the post option.

link|improve this question
It may be the context it's running in. For example, if the URL is a 'localhost' URL or uses a site name that's not fully qualified, you may be connecting to two different machines. – David Schwartz Jan 21 at 1:46
added an edit.. – SuperSpy Jan 21 at 2:04
feedback

2 Answers

I can't tell you a strait forward answer, because this never has happened to me. But try:

$postData = 'user='.urlencode($user).'&paswoord='.urlencode($pass);

On a side note, is "paswoord" supposed to be "password"?

Also gzip might be the issue, this is unes

link|improve this answer
About your side note: The persons of the other website mix dutch with english. It kind of stupid since they're 'professionals'. School hired them to display our schedules. But they messed up a bit. – SuperSpy Jan 21 at 12:14
I tried turning of gzip, but the same happens: the code works on my host but not local. – SuperSpy Jan 21 at 12:17
Does dutch have special characters outside of ASCII? I really can't help with this. – Michael Ozeryansky Jan 23 at 18:34
feedback

If it works on "your host" but not on "localhost" there is propably a different setup for both hosts. Are there different VHost-Settings in the Apache-HTTPD?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.