curl-and-php
PHP/CURL HTTP PUT sample code?
Date: Wed, 1 Feb 2006 15:31:59 -0800
I did use "CURLOPT_PUT, 1". But where does the data I want to sent get
set? I want to send either a string or an int to a location on the http
server. The url is something like
http://localhost/save/me/here?type=string . I want to send
"this%20a%20string" to that location.
$url = "http://localhost/save/me/here?type=string";
$data = "this%20a%20string"; // where do I put this?Postfield
doesn't work.
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$returned = curl_exec($ch);
$len = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
Tom
From: garaged <garaged_at_gmail.com>
Date: 2006-02-01
Set CURLOPT_PUT, 1
That's it
Max
Hi,
I am trying to use libcurl to do an HTTP PUT of a string to a URL
(http://localhost:8080/store/me/here?type=string) . I looked all over
but cannot
find any examples of PUT. How do I get the data to that location? This
is not
a POST so I can't use CURLOPT_POSTFIELDS. Any ideas? Thanks,
Tom Ralston
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-02-02