Justin Finkelstein | 6 Oct 2008 14:28
Favicon

unable to set private key file

Hi guys

I am using cURL to connect to a secure web service via HTTPS and, from the
command-line, this works fine but from within PHP it doesn't. I've spent almost
a whole day trying to resolve this and can't see a solution so I thought someone
else might know.

I originally have a PKCS#12 combined multicertificate which I split into its
components:

openssl pkcs12 -in MULTICERT.p12 -out ca.pem -cacerts -nokeys
openssl pkcs12 -in MULTICERT.p12 -out client.pem -clcerts -nokeys
openssl pkcs12 -in MULTICERT.p12 -out key.pem -nocerts 

I set the PEM passphrase for the key to 'password' for testing, and test that
this all works via command-line:

curl -v --key ./key.pem --cacert ./ca.pem --cert ./client.pem:password
https://www.mbnet.pt/pvtn

I get a response back, which means that the keys are understood by cURL.

Translated into PHP, the code for the above line is:

$ch = curl_init();

curl_setopt($ch, CURLOPT_VERBOSE, '1');
curl_setopt($ch, CURLOPT_SSLKEY, 'key.pem');
curl_setopt($ch, CURLOPT_CAINFO, getcwd().'/ca.pem');
curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/client.pem');
(Continue reading)

S A. | 10 Oct 2008 18:15

nss/ssl issue

Hello everybody.

Here's what firefox's live headers addon show me ... I'm just trying to
make a simple script to login on that site just as my normal browser would
do ..
Anyone any ideas? Thanks in advance.

* Connected to etisalat.com.eg (196.219.46.2) port 80 (#0)
> GET
/pls/portal/portal.wwptl_login.show_site2pstoretoken?p_ref=XXXX_LOGIN_XXXXXX&p_url=http%3A%2F%2Fetisalat.com.eg%2Fpls%2Fportal%2Furl%2Fpage%2F%2FEtisalat%2FLogin
HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.2)
Gecko/2008100707 Fedora/3.0.2-1.fc10 Firefox/3.0.2
Host: etisalat.com.eg
Accept: */*
Cookie:
portal=9.0.3+en-us+us+AMERICA+58E90945621D6F9CE04400144F3E96AB+3ECA006DxXXXxxXxxXxxxXX29EED8D85D9D8B2BDD677B5F68B8A4FED9A2A4DA4AB56D0DBBF13B0514EF8B3F551534627D2B08F0D5DC7FE5C26AD69FA77413ACB49E7B815374D9E7654589FB52E5FB497292D975C1563D

< HTTP/1.1 200 OK
< Cache-Control: max-age=0
< Content-Type: text/html; charset=UTF-8
< Server: Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server
OracleAS-Web-Cache-10g/10.1.2.0.2
(H;max-age=240+0;age=37;ecid=720577003xxx09813,0)
< Content-Length: 609
< Date: Fri, 10 Oct 2008 15:53:35 GMT
< Content-Location:
/servlet/RepositoryServlet/portal/portal.wwptl_login.show_site2pstoretoken
<
* Connection #0 to host etisalat.com.eg left intact
(Continue reading)

Daniel Stenberg | 10 Oct 2008 21:10
Picon
Favicon
Gravatar

Re: nss/ssl issue

On Fri, 10 Oct 2008, S A. wrote:

> Here's what firefox's live headers addon show me ... I'm just trying to make 
> a simple script to login on that site just as my normal browser would do .. 
> Anyone any ideas? Thanks in advance.

> * Connection #0 to host etisalat.com.eg left intact
> * About to connect() to auth.etisalat.com.eg port 443 (#1)
> *   Trying 196.219.46.14... * connected
> * Connected to auth.etisalat.com.eg (196.219.46.14) port 443 (#1)
> *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
>  CApath: /etc/pki/tls/certs/
> * NSS error -12226

Looks like a SSL-level problem with NSS. (A bit funny since Firefox is also 
using NSS.)

Can you get any HTTPS contents off this last server?

--

-- 

  / daniel.haxx.se
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

S A. | 10 Oct 2008 22:18

Re: nss/ssl issue

> Looks like a SSL-level problem with NSS. (A bit funny since Firefox is
> also
> using NSS.)
>
> Can you get any HTTPS contents off this last server?
>

No, it exits there ! Problem solved now, got the fc package, edited the
.spec and recompiled to use openssl instead of nss.. works like a charm !
:)

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Andris Kardos | 24 Oct 2008 12:41
Picon

curl_multi_wait?

Dear curl/PHP folks,
Don't you think a function, that waits for all multi handles to finish or
timeout would be useful? Using curl_multi_select is a waste of time with fast
url-fetches. Calling curl_multi_exec repeatedly is also a wast of CPU cycles,
even ef you "sleep" a little between calls. I think a simple "curl_multi_wait"
that will return when al handles are done (success or timeout) would be a very
welcome addition. Implemented in the curl_ext, and not in PHP. Whom should I ask
to implement it? Are the extension's developers here. Anyone else agrees with me
that this is missing. Or do I miss something about how to use curl with PHP?
Thanks,
AndrĂ¡s

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
David Colter | 24 Oct 2008 22:39
Picon
Favicon

Cookies: Desperately Need Help

Hello all,

Can anyone provide a different view on why cURL sends 2 extra cookies that don't belong (seem) to belong to
the target domain and don't get sent when using a browser. I apologize for the long content to follow. It is
my hope that someone will see the glitch. Btw, I'm an airline pilot, doing this for fun and to make computer
life easier???

The background is that I use 3 php/curl pages to accomplish a task normally taking more steps and lots of
useless data. The first page performs 13 curl transfers, to include login, and successfully gets the
proper data. Selecting an item on this page requests the second page with only 1 curl transfer and also
successfully gets the correct response. Then, requesting the 3rd page,which conducts 16 curl requests,
there are 2 cookies that get sent, and it is my guess that this causes the server to respond differently. The
primary emphasis is this help request is the presence of these 2 cookies being sent by curl. These two are: 

portalNRTP=10%2F23%2F2008+8%3A57%3A29+AM; portalUser=00354611; (see the next block for where they
are set)

They are received and set during 1st (ok) page as shown in the verbose output:

* Closing connection #2
* Connection (#2) was killed to make room (holds 6)
* About to connect() to www.jetnet.aa.com port 443 (#2)
*   Trying 216.39.75.19... * connected
* Connected to www.jetnet.aa.com (216.39.75.19) port 443 (#2)
* successfully set certificate verify locations:
*   CAfile: /usr/share/ssl/certs/ca-bundle.crt
  CApath: none
* SSL re-using session ID
* SSL connection using RC4-MD5
* Server certificate:
(Continue reading)

Daniel Stenberg | 27 Oct 2008 21:40
Picon
Favicon
Gravatar

Re: curl_multi_wait?

On Fri, 24 Oct 2008, Andris Kardos wrote:

> Don't you think a function, that waits for all multi handles to finish or 
> timeout would be useful? Using curl_multi_select is a waste of time with 
> fast url-fetches.

Why is it a waste and exactly how would "curl_multi_wait" be different?

> Whom should I ask to implement it?

You can of course discuss it with anyone you like, but if you want it done you 
should probably consider doing it yourself or hiring someone to write the code 
for you.

> Are the extension's developers here.

Nope. But AFAIK there hardly is any "developer" of the PHP/CURL extension...

--

-- 

  / daniel.haxx.se
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Thorben Thuermer | 29 Oct 2008 16:16
Picon

passing data back from curl callbacks in php

Hello,

i've been using libcurl in C programs before, but now i'm trying to use the php
binding to do similar stuff, and i'm running into the following issue:

- libcurl uses callbacks to pass received headers and data back to the application
- the callbacks can be set with the php api

- with the C api, a userdata pointer (CURLOPT_READDATA) is passed to the callback,
  also you can store userdata in the curl handle (CURLOPT_PRIVATE) which is
  available from inside the callback by using getopt on the handle...
- in the php api those two are missing?!?

so, with the php api, it seems that the only way to pass results of processing the
data or headers back to the application from within the callbacks is using global
variables, which is really ugly...

am i missing something maybe?

(if you can't see the relevance:
i'm writing a function that passes through data from a remote server, but in the
case that the headers indicate an error, i need to pass control back to the caller
(by returning an error message).
that error would be detected in the headerfunction, but there's no way to pass a
message from there back to the point where curl_exec was invoked, other than by
setting a global variable.
if it was possible to pass a variable reference using READDATA or PRIVATE, that
could be used.
a similar problem would be trying to store cookies from the headers, for example)

(Continue reading)

Adam Stelmack | 31 Oct 2008 19:36
Favicon

curl error 6 Couldn't resolve host in PHP

Hi,

Have been trying to get curl working on our new server and redesigned 
site.  Server is openBSD4.3, php and curl installed from packages.  PHP 
version 5.2.5, curl version libcurl/7.17.1 OpenSSL/0.9.7j zlib/1.2.3 
libidn/1.1.

Trying to connect to a credit card processing company's testbed 
environment, however curl seems to never be able to resolve the hostname 
when run through PHP.  I have been able to telnet and ping the hostname 
and it has resolved without issue.  Was even able to resolve and connect 
when I just ran curl on the command line just fine.  The problem only 
seems to be when trying to use the PHP curl implementation.  Have been 
searching on google and a little bit on the archives for possible 
solutions and come up empty.  All solutions I have found degraded to 
"it's your hosting company, their DNS is broken" however, this is an 
internal server and the only thing having trouble resolving dns is this 
webserver and ONLY when trying to use curl in PHP.

Code is as follows, pretty straightforward (leaving out url for security 
reasons, but url is properly formed, I have tested it):

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);
  curl_setopt ($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$dataToSend);
  curl_setopt($ch,CURLOPT_TIMEOUT,$gArray['CLIENT_TIMEOUT']);
(Continue reading)


Gmane