curl-and-php
RE: Need to pull header fields out of https post reply
Date: Fri, 22 Nov 2002 08:57:07 +0100
>From a browser, I do get back a body
>saying invalid username,password
I'm not sure to well understand what you did...to enter a site, get the HTML
code from your login page,
put all the input names from your HTML code into your URL:
HTML code example:
<FORM NAME='loginForm' method='post' action='/script/connect'>
<input type='hidden' name='action' value='Login'/>
<input type='hidden' name='target' value='_top'/>
<tr><td>username:</td><td><input type='text' name='username'/></td></tr>
<tr><td>password:</td><td><input type='password' name='password'/></td>
<td><A HREF='javascript:document.loginForm.submit()'>login</A></td></tr>
</FORM>
And try the URL resulting:
https://secure.authorize.net/script/connect?action=Login&target=_top&usernam
e=your-username&password=your-password
Sometimes the *non* hidden inputs are not required, but I already had
problems because of it, so...
>but from within my php script, nothing comes back.
If you didn't give your username and password that's normal. With the same
HTML example you can try this:
<?php
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,
"https://secure.authorize.net/script/connect?action=Login&target=_top&userna
me=your-username&password=your-password");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
ob_start(); // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean();
curl_setopt ($ch, CURLOPT_URL,
"https://secure.authorize.net/gateway/transact.dll");
curl_setopt ($ch, CURLOPT_HEADER, 1);
ob_start();
curl_exec($ch);
$string = ob_get_contents();
ob_end_clean();
curl_close($ch);
echo $string;
?>
Try the URL connection in your browser first, just to be sure that you
didn't forget anything.
>What is the minimum version of libcurl needed to do https??
I don't think that the problem comes from libcurl here...
I use this kind of code for 1 month, and it works perfectly.
Hope this helps.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-11-22