Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Code PHP without PEAR
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
raphox  
View profile  
 More options Feb 10 2012, 11:30 am
From: raphox <raphox.ara...@gmail.com>
Date: Fri, 10 Feb 2012 08:30:49 -0800 (PST)
Local: Fri, Feb 10 2012 11:30 am
Subject: Code PHP without PEAR
Hy guys,

hello guys,

I saw the old site an example of PHP code for connecting to
Webservice. But unfortunately, the code uses a PEAR package, that
sometimes makes it difficult for users.
So I made a version using CURL (native PHP), so most users can they
use the biblitoteca.
If you want to publish on the site, feel free. Not be necessary to
assign copyright if no interest.

Thank you.

<?php

class DocumentConverterClient {

    var $url = "http://localhost:8080/converter/service";

    function convert($inputData, $inputType, $outputType) {
                $tuCurl = curl_init();

                curl_setopt($tuCurl, CURLOPT_URL, $this->url);
                curl_setopt($tuCurl, CURLOPT_POST, true);
                curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $inputData);
                curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type: " .
$inputType, "Accept: " . $outputType, "Content-length: " .
strlen($inputData)));

                $tuData = curl_exec($tuCurl);

                curl_close($tuCurl);

                if(curl_errno($tuCurl)){
                        throw new Exception(curl_error($tuCurl));
                }

                return $tuData;
    }

}

$documentConverter = new DocumentConverterClient();

$inputFile = "document.odt";
$inputType = "application/vnd.oasis.opendocument.text";
$outputFile = "document.pdf";
$outputType = "application/pdf";

$outputData = $documentConverter-

>convert(file_get_contents($inputFile), $inputType, $outputType);

file_put_contents($outputFile, $outputData);

?>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »