[Vtigercrm-developers] Receiving data from outside sources

Sergio A. Kessler sergiokessler at gmail.com
Tue Feb 28 07:13:39 PST 2006


like, look in

http://developer.yahoo.net/php/

there are various code samples there...

basically you don't need a specialized library, good old
file_get_contents is your friend ;-)
(or you can use the curl extension)

I'm imagining something like:

exporting:
www.domain.com/api/index.php?action=export_clients&output=csv
or
www.domain.com/api/index.php?action=export_clients&output=xml

importing:
www.domain.com/api/index.php?action=import_client

this last call should be made by a POST action, passing in the data,
can be made by a simple php script, something like

 foreach line in the source csv_file
 {
    $postargs = <fill with the client's data>

    // Get the curl session object
    $session = curl_init($request);

    // Set the POST options.
    curl_setopt ($session, CURLOPT_POST, true);
    curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
    curl_setopt($session, CURLOPT_HEADER, true);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

    // Do the POST and then close the session
    $response = curl_exec($session);
    curl_close($session);


of course, the folder "api" should be protected wrt security.

/sak


On 2/28/06, Mike Fedyk <mfedyk at mikefedyk.com> wrote:
> Sergio A. Kessler wrote:
>
> >On 2/27/06, Mike Fedyk <mfedyk at mikefedyk.com> wrote:
> >
> >
> >>The focus of the question is how to get data in and out of vtiger using
> >>public interfaces from another automated system.  I would like to renew
> >>that question.  Is SOAP the only and/or best answer in this area?
> >>
> >>
> >
> >nop.
> >SOAP is a complex beast that must die.
> >
> >you can use REST (web services done right).
> >
> >just like yahoo does with php:
> >
> >http://developer.yahoo.net/php/
> >http://developer.yahoo.net/php/howto-reqRestPhp.html
> >
> >note that with "output" parameter you can control what you get, ie.
> >CSV, XML, txt, whatever.
> >
> >
> Have any links to php libraries for REST?  I'm reading through the
> various articles in Wikipedia right now...




More information about the vtigercrm-developers mailing list