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

curl-and-php

Digest Authentication in php curl

From: Luke Painter <Luke.Painter_at_talis.com>
Date: Wed, 15 Aug 2007 23:55:54 +0100

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/1188131
118062" />
    <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/1188131
118062" />
    <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/1186808
840136" />
  </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.

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