Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:57+00:00 2026-06-13T05:59:57+00:00

I got a weird issue. I hope someone could help me. I am new

  • 0

I got a weird issue. I hope someone could help me.

I am new to Zend and I’m writing a RESTfull API.

When I run the curl command as POST method, it calls the putAction() function.

For example, I am run a curl command:

curl -X POST http://localhost/ws/user/post -v

Here is the response:

* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> POST /ws/user/post HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 22 Oct 2012 13:37:56 GMT
< Server: Apache/2.2.14 (Ubuntu)
< X-Powered-By: PHP/5.3.2-1ubuntu4.18
< Vary: Accept-Encoding
< Content-Length: 53
< Content-Type: text/html
< 
* Connection #0 to host localhost left intact
"From putAction() updating the requested article"
Method = POST
* Closing connection #0

Here is the code:

[...]
public function postAction() {
    echo 'Method = ' . $_SERVER['REQUEST_METHOD'];

    if (!$id = $this->_getParam('id', false)) {
        $this->sendResponse("Bad request. Id is missing", 400);
    }

    $this->sendResponse("From postAction() creating the requested article", 201);
}

public function putAction() {
    echo 'Method = ' . $_SERVER['REQUEST_METHOD'];
    $this->sendResponse("From putAction() updating the requested article");
}
[...]

Any ideas ?


EDIT:

I realized that I put this code in my bootstrap:

public function _initRestRoute() {
    $front = Zend_Controller_Front::getInstance();
    $router = $front->getRouter();

    $restRoute = new Zend_Rest_Route($front, array(), array(
        'ws',
    ));

    $router->addRoute('rest', $restRoute);
}

When I comment it, it works.

Any explanations ? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:59:58+00:00Added an answer on June 13, 2026 at 5:59 am

    You shouldn’t be having http://localhost/ws/user/post in your request while using the Zend_Rest_Route. This route interprets /user/post as parameters and changes action from post to put. Try http://localhost/ws instead.

    See Zend/Rest/Route.php line 208.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hoping someone might help me figure out the weird issue I'm having with jQuery.
I've run accorss a really weird issue, in eclipse I've got a codebase I've
I've got a weird issue that almost seems like a Visual Studio 2008 issue.
I have got one weird issue. I am working on an asp .net mvc
I've got a weird issue with segues - I have a segue open a
Hey, I got kind of a weird issue here. I have an iPhone-only OpenGL
I got very weird issue with managedObjectContext:save. It hasn't happened at the first time
Hey guys I got a weird issue.. I have a datalist that's only loaded
So, I've run into a weird issue with a route in my application. For
Issue Weird problem. We've got two forms: the main application window and a settings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.