Re: how to curl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 9, 2008 at 8:11 AM, mukesh yadav <mak.gnu@xxxxxxxxx> wrote:

>
>>
>> remember, serverB should be speaking http.  were you unable to understand
>> its usage looking at the manual,
>>
>>
>
> Yes nathan i'm not able to understand how to pass the sql query can you
> give me one small eg.
>
> like
>
> $sql = select * from table where id = $var ;
>
> how i'll send this query using cURL to get the result. from remote server.
>
> in manual i'm not able to find the way query executes.
>
> thanks
>

mukesh,

im happy to respond, but please keep the conversation on the list, so that
others may benefit by having it available in the archives.

i have a few questions as well; is the query being executed on the provider
system (that is the one you intend to send the http request to)?  also, are
you writing and deploying code to both of these systems, or just on the
consumer (the one you intend to execute the curl request from)?

either way, i can say that programmatic http interfaces are usually built to
deliver services, such as an api for an online application.  these
interfaces offer methods much like those in php (or many other languages),
they take a well defined set of argumets, and have a well defined return
value.

in your case, i would expect the provider to expose some url that would
essentially represent the query you intend to execute.  it would then expect
the consumer to provide an id during the request, so that it can use that in
the query.  then it would return the result, nearly verbatim from the
database.

so, if the provider supported the method as http GET, you might see
something like this, which you would execute via curl,

http://myrestapi.com/getAllFromTable?id=56

then, the provider would grab the id right out of $_GET (if it were also
written in php).

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux