put

Upload a file using an API PUT request

穿精又带淫゛_ 提交于 2019-11-28 22:36:17
问题 I'm building an API in PHP. One of the methods is place.new (PUT request). It expects several string fields, and it also expects an image. However I can't get it working. With a POST request it was easy, but I'm not sure how to do it with a PUT and how to get the data on the server. thanks for the help! Test CURL code $curl = curl_init(); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl,

Using PUT method with PHP cUrl Library

别说谁变了你拦得住时间么 提交于 2019-11-28 17:15:43
I'm able to run the following curl command (at the command line) successfully: curl -XPOST --basic -u user:password -H accept:application/json -H Content-type:application/json --data-binary '{ "@queryid" : 1234 }' http://localhost/rest/run?10 Here is what I'm doing so far however it doesn't seem to be working with the REST service I'm using: $headers = array( 'Accept: application/json', 'Content-Type: application/json', ); $url = 'http://localhost/rest/run?10'; $query = '{ "@queryid" : 1234 }'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

Enabling PUT on IIS 7.5 for an ASHX handler using Windows Authentication

◇◆丶佛笑我妖孽 提交于 2019-11-28 13:34:05
I have an ASP.NET (.NET 4) website that uses http PUT for an .ashx generic handler. The PUT call originates from a Silverlight front end. All works in VS 2010 on my local machine (Cassini web server). Then I deployed to an IIS7.5 Win Server 2008 R2 box. The silverlight/website is fine, but PUT calls to the .ashx handler are met with a Windows Login Prompt. This is a local intranet so Windows Authentication (with NTLM & Negotiate providers) is the only enabled authentication. Then I read this: http://blogs.msdn.com/b/joseph_fultz/archive/2009/07/23/enabling-the-put-verb-with-handlers-and-iis-7

How to get filename in php in put request

假装没事ソ 提交于 2019-11-28 05:32:10
问题 I know we can read put request in file using file_get_contents("php://input"); But how do i get the filename in the put request? 回答1: Filename is not sent as a part of the request. If you want to get the filename on the server side, you will have to pass it along by other means, i.e. query parameters. 回答2: If you're using PUT like in PUT Method Support page, you can get the filename they PUT to as $_SERVER['REQUEST_URI'] For example, if I have the receiving PHP script <?php /* PUT data comes

PUT vs. POST for files upload RESTful api to be built using Zend Framework

柔情痞子 提交于 2019-11-28 03:11:47
I'm building a RESTful api using Zend Framework via the Zend_Rest_Route. For files upload, should I use PUT or POST to handle the process? I'm trying to be as consistent as possible with the definition of the REST verbs. Please refer to: PUT or POST: The REST of the Story The way I understand this is that I should use PUT if and only if I'm updating the full content of the specified resource. I'll have to know the exact URL to PUT to. On the other hand, I should use POST if I'm sending a command to the server to create a subordinate of the specified resource, using some server-side algorithm.

Enabling PUT on IIS 7.5 for an ASHX handler using Windows Authentication

我是研究僧i 提交于 2019-11-27 19:29:51
问题 I have an ASP.NET (.NET 4) website that uses http PUT for an .ashx generic handler. The PUT call originates from a Silverlight front end. All works in VS 2010 on my local machine (Cassini web server). Then I deployed to an IIS7.5 Win Server 2008 R2 box. The silverlight/website is fine, but PUT calls to the .ashx handler are met with a Windows Login Prompt. This is a local intranet so Windows Authentication (with NTLM & Negotiate providers) is the only enabled authentication. Then I read this:

How to receive a file via HTTP PUT with PHP

无人久伴 提交于 2019-11-27 18:32:07
This is something that has been bugging me for a while.. I'm building of a RESTful API that has to receive files on some occasions. When using HTTP POST , we can read data from $_POST and files from $_FILES . When using HTTP GET , we can read data from $_GET and files from $_FILES . However, when using HTTP PUT , AFAIK the only way to read data is to use the php://input stream . All good and well, untill I want to send a file over HTTP PUT. Now the php://input stream doesn't work as expected anymore, since it has a file in there as well. Here's how I currently read data on a PUT request:

How do you do an HTTP Put?

…衆ロ難τιáo~ 提交于 2019-11-27 17:40:08
We have this software that has a webservices component. Now, the administrator of this system has come to me, wanting to import data into the system by using the webservices component. So, I went to read the documentation to try to figure this thing out and I am seeing things like this: Click here to see what I'm talking about (this looks best in firefox, chrome, & safari) That documentation gives examples of interacting with the system using HTTP verbs such as GET, POST, PUT, DELETE. But in my limited experience, I have never had to send neither an HTTP PUT nor a DELETE. How do you do it? I

Using PUT method with PHP cUrl Library

吃可爱长大的小学妹 提交于 2019-11-27 10:20:27
问题 I'm able to run the following curl command (at the command line) successfully: curl -XPOST --basic -u user:password -H accept:application/json -H Content-type:application/json --data-binary '{ "@queryid" : 1234 }' http://localhost/rest/run?10 Here is what I'm doing so far however it doesn't seem to be working with the REST service I'm using: $headers = array( 'Accept: application/json', 'Content-Type: application/json', ); $url = 'http://localhost/rest/run?10'; $query = '{ "@queryid" : 1234 }

How do I access PHP REST API PUT data on the server side?

為{幸葍}努か 提交于 2019-11-27 09:13:44
-- Question -- I am just starting out with the REST API and am getting pretty confused. This is what my PHP cRUL client-side looks like for a PUT. case 'PUT': curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); break; Now when I look at the server my $_SERVER['REQUEST_METHOD'] shows PUT, but my question is how do I get the $data I sent with CURLOPT_POSTFIELDS. All I need to do is get the $data sent with a PUT request into the next line. Like $value = $data['curl_data']; I have seen so much clutter on this topic that it is giving me a headache.