Linden Lab Official:Reg API Examples
Back to RegAPI Main Page
Linden Lab provided sample code is here:
- Examples
- Downloads
- NOTE- the LLSD library has a bug and a new version will be released on 5/21.
- Add the following line to the function llsd_post_string().
Add: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
--Xugu Madison 21:21, 10 September 2008 (BST): I've got a simple LLSD and RegAPI implementation written in Java, which we use locally. You can grab a copy at http://archipelago.cs.st-andrews.ac.uk/llsd-java/src/llsd-java-0.2.zip .
--Ingmar Rasmuson 02:16, 23 May 2007 (PDT): In addition to the patch I suggested, have a look at the CURL debug section I proposed. It might come in handy when debugging the SSL communication (citing my email to LLB):
As you know, this took me some time to figure out, so perhaps others could benefit from this solution, too:
I've added a
// Enable curl debug messages, off by default define("CURL_DEBUG", FALSE);
at the beginning of the API library for turning CURL debugging on and off and altered the llsd_post_string() function in this way:
function llsd_post_string($url, $str) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_POST, TRUE); //suggested patch - start curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //suggested patch - end curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/xml")); curl_setopt($ch, CURLOPT_POSTFIELDS, $str); $doc = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //suggested debug section - start if (CURL_DEBUG) { print_r(curl_getinfo($ch),"CURL getinfo()"); echo "URL error number: " .curl_errno($ch); echo "URL error: " . curl_error($ch); } //suggested debug section - end curl_close($ch); return llsd_decode($doc); }