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

curl-and-php

Re: Debug HTTPS Curl Request

From: shiplu <shiplu.net_at_gmail.com>
Date: Wed, 10 Nov 2010 16:42:22 +0600

On Tue, Nov 9, 2010 at 3:53 AM, Daniel Cole <dcole_at_wehostit.com.au> wrote:

> Hi Shiplu,
>
>
>
> I have tried to replicate the process using the command line version of
> cURL but I’m afraid I’m a bit out of my depth here. I have attached a copy
> of the PHP script that is run (note: this is invoked from a separate
> script). As you will be able to see it deals with cookies and logging in.
>
>
>
> If you could please provide some pointers on how to perform this action
> from the command line would be greatly appreciated.
>
>
>
> Thanks,
>
> Daniel
>

Hello Daniel,

The best way is to debug your PHP code using a remote debugger (eg. xdebug)
with a suitable IDE (eg. eclipse). You can figure out there what happening
by observing the values.

Here is a command for your login method.

curl -k -i -L -b cookie.txt -c cookie.txt -d
'mappedUrl=/BENDIGO&is-login-request=true&ownerId=MERCHANT_ID&userName=USERNAME&password=PASSWORD&loginForm=LOG%20IN'
https://SERVER/ENDPOINT

Change it according to your credential. You can understand whats going on
there in command line very easily.
For other method build same type of command just by changing the parameters
and endpoint.
Hope this will help you to debug HTTPS request.

One thing I must say, CURLOPT_POSTFIELDS[1] accepts string. Not array. But
you can create your url encoded string using http_build_query[2] function.

[1] http://php.net/curl_setopt
[2] http://php.net/http_build_query

-- 
Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2010-11-10