469,926 Members | 2,174 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

CURL = Error 501

Hi,

Friend of my set up for me an apache server (Apache/2.2.0 (Fedora),
php5, mod_rewrite, etc.. - http://serwer2.profprojekt.com.pl/info.php).

Everything works just fine, but i can't send HTTP_Request with data in
POST using CURL. Server returns error:
--------------------------------------------------------------------------------------
501 Method Not Implemented

Method Not Implemented
POST to /app/webroot/cake_gateway.php not supported.
--------------------------------------------------------------------------------------

When i'm sending requests with post using forms or ajax server manages
it faultlessly...

Anyone knows where should we looking for bug ?

best
wojtek

Sep 23 '07 #1
5 5534
ko******************@gmail.com wrote:
Hi,

Friend of my set up for me an apache server (Apache/2.2.0 (Fedora),
php5, mod_rewrite, etc.. - http://serwer2.profprojekt.com.pl/info.php).

Everything works just fine, but i can't send HTTP_Request with data in
POST using CURL. Server returns error:
--------------------------------------------------------------------------------------
501 Method Not Implemented

Method Not Implemented
POST to /app/webroot/cake_gateway.php not supported.
--------------------------------------------------------------------------------------

When i'm sending requests with post using forms or ajax server manages
it faultlessly...

Anyone knows where should we looking for bug ?

best
wojtek
That's a server response code.

Are you sure you're posting to the correct page? Can you post to THAT
PAGE from a browser?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 23 '07 #2
That's a server response code.
>
Are you sure you're posting to the correct page? Can you post to THAT
PAGE from a browser?
yes, when i'm using form to post it works fine

best
wojtek

Sep 23 '07 #3
ko******************@gmail.com wrote:
>That's a server response code.

Are you sure you're posting to the correct page? Can you post to THAT
PAGE from a browser?

yes, when i'm using form to post it works fine

best
wojtek
It shouldn't be any different.

However, you didn't post any code, and my crystal ball is in the shop,
so I have no idea what your problem might be.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 23 '07 #4
It shouldn't be any different.
>
However, you didn't post any code, and my crystal ball is in the shop,
so I have no idea what your problem might be.

--
yeah, i didn't post any code, because i'm sure that code is correct -
i think that the problem is on server but i don't know where should i
be looking it, anyway here is the code:

function doCurlRequest($data)
{
//This portion taken from SabreAMF (released under LGPL)

$error = NULL;
$ch = curl_init($this->gatewayUrl);

curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT,20);
curl_setopt($ch,CURLOPT_HTTPHEADER,array(AMFPHP_CO NTENT_TYPE));
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);

$result = curl_exec($ch);

if (curl_errno($ch)) {
$this->lastError = 'CURL error: ' . curl_error($ch);
return false;
} else {
curl_close($ch);
}

//Is the result valid so far?
if($result[0] != chr(0))
{
//If chr(0) is not the first char, then this result is not good
//Strip html
$this->lastError = trim(strip_tags(str_replace('<td', " <td",
$result)));
return false;
}
return $result;
}

as i say before it's AMFPHP getaway lots of people using it without
any problems. as well it's works great on my local server...

best
wojtek

Sep 23 '07 #5
ok, i've solved the problem

it was about mod_security. Replacing row with

SecRule REQUEST_HEADERS:Content-Type "!(?:^(?:application/x-www-form-
urlencoded$|multipart/form-data;)|text/xml)"
to
SecRule REQUEST_HEADERS:Content-Type "!(?:^(?:application/x-www-form-
urlencoded$|multipart/form-data;)|text/xml|application/x-amf)"

makes it works perfectly.

thanks for your time
best
wojtek

Sep 23 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Haluk Durmus | last post: by
3 posts views Thread by Chris Fortune | last post: by
1 post views Thread by lists04 | last post: by
4 posts views Thread by zorro | last post: by
1 post views Thread by c1pkw | last post: by
1 post views Thread by sik of it | last post: by
3 posts views Thread by rottmanj | last post: by
11 posts views Thread by Flexor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.