cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Digest Authentication in php curl

From: haroon ahmad <haroon_at_fastcreators.com>
Date: Thu, 16 Aug 2007 09:23:02 +0500

Just wanted to make a note here that a few days back a dude was asking about
xml-rpc and how to post xml data using cURL, so if he is reading this, see
the code this fellow has written this is how you can post xml data to a link
which parses that xml packet from headers and then perform processing and
generate or post back response.

thank you

Regards,
Haroon Ahmad
Sr. Web Developer
www.fastcreators.com

On 8/16/07, Luke Painter <Luke.Painter_at_talis.com> wrote:
>
> *From:* curl-and-php-bounces_at_cool.haxx.se [mailto:
> curl-and-php-bounces_at_cool.haxx.se] *On Behalf Of *Luke Painter
> *Sent:* 15 August 2007 23:56
> *To:* curl-and-php_at_cool.haxx.se
> *Subject:* Digest Authentication in php curl
>
>
> Hello,
>
> I'm trying to use curl for digest authentication but I'm getting
> timeouts. Is it possible to use php curl for digest authentication? I
> followed a thread about digest authentication for the c api so I know it's
> available in the library directly.
>
> Here's what I'm trying to post:
>
> <?php
> $rdfXML = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:cs="http://purl.org/vocab/changeset/schema#">
> <rdf:Description rdf:nodeID="cs">
> <rdf:type rdf:resource="
> http://purl.org/vocab/changeset/schema#ChangeSet" />
> <cs:subjectOfChange rdf:resource="
> http://api.talis.com/stores/list-tenants-dev/items/1188131118062" />
> <cs:createdDate>2007-08-15T23:35:27Z</cs:createdDate>
> <cs:creatorName>Anonymous</cs:creatorName>
> <cs:changeReason>Cos I said so!</cs:changeReason>
> <cs:addition rdf:nodeID="rem1" />
> </rdf:Description>
> <rdf:Description rdf:nodeID="rem1">
> <rdf:type rdf:resource="
> http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" />
> <rdf:subject rdf:resource="
> http://api.talis.com/stores/list-tenants-dev/items/1188131118062" />
> <rdf:predicate rdf:resource="
> http://schemas.talis.com/2006/recordstore/schema#tenant" />
> <rdf:object rdf:resource="
> http://api.talis.com/stores/list-tenants-dev/items/1186808840136" />
> </rdf:Description>
> </rdf:RDF>';
>
> $lengh = strlen($rdfXML);
>
> $headers[] = 'Accept: */*';
> $headers[] = 'Content-Type: application/rdf+xml; charset=utf-8';
> $headers[] = "Content-Length: $lengh";
>
> $poster = curl_init('api.talis.com/stores/list-tenants-dev/meta');
>
> curl_setopt($poster, CURLOPT_FOLLOWLOCATION, TRUE);
> curl_setopt($poster, CURLOPT_CONNECTTIMEOUT, 2);
> curl_setopt($poster, CURLOPT_TIMEOUT, 60);
> curl_setopt($poster, CURLOPT_HTTPHEADER, $headers );
> curl_setopt($poster, CURLOPT_HEADER, 1);
> curl_setopt($poster, CURLOPT_USERPWD, 'zephyrapp:uh45k89ruw');
> curl_setopt($poster, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
> curl_setopt($poster, CURLOPT_CUSTOMREQUEST, 'POST');
> curl_setopt($poster, CURLOPT_POSTFIELDS, $rdfXML);
>
> $raw_response = curl_exec($poster);
>
> echo $raw_response;
>
> curl_close($poster);
> ?>
> Thanks,
> Luke
>
>
> Book your free place now at Talis Insight 2007 www.talis.com/insight
>
> Find out more about Talis at www.talis.com
>
> Shared InnovationTM
>
> Any views or personal opinions expressed within this email may not be
> those of Talis Information Ltd. The content of this email message and any
> files that may be attached are confidential, and for the usage of the
> intended recipient only. If you are not the intended recipient, then please
> return this message to the sender and delete it. Any use of this e-mail by
> an unauthorised recipient is prohibited.
>
>
> Talis Information Ltd is a member of the Talis Group of companies and is
> registered in England No 3638278 with its registered office at Knights
> Court, Solihull Parkway, Birmingham Business Park, B37 7YB.
> ------------------------------
>
> P.s. I've used the command line curl and it works, i.e. the entry to the
> web data store is seen.
>
>
> Book your free place now at Talis Insight 2007 www.talis.com/insight
>
> Find out more about Talis at www.talis.com
>
> Shared InnovationTM
>
> Any views or personal opinions expressed within this email may not be
> those of Talis Information Ltd. The content of this email message and any
> files that may be attached are confidential, and for the usage of the
> intended recipient only. If you are not the intended recipient, then please
> return this message to the sender and delete it. Any use of this e-mail by
> an unauthorised recipient is prohibited.
>
>
> Talis Information Ltd is a member of the Talis Group of companies and is
> registered in England No 3638278 with its registered office at Knights
> Court, Solihull Parkway, Birmingham Business Park, B37 7YB.
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-08-16