Re: Authorize.net example

From: Date: Mon, 11 Mar 2002 16:28:52 +0000
Subject: Re: Authorize.net example
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-88026@lists.php.net to get a copy of this message
Ahh, you had the same problem as I. Fortunately, I've worked out a pretty good fix. It makes use of the CURL module in PHP. I think CURL comes standard in the 4.x versions of PHP, but I'm not sure. Anywho, here's the code: ------BEGIN CODE--------- <?php $ch = curl_init("https://url.authnet.com"); $data = "x_Version=3.0&x_Login=loginname&x_adc_url=False&x_adc_delim_data=TRUE&x_car d_num=1234123412341234&x_exp_date=0104&x_Amount=24.45&x_Test_Request=TRUE&x_ Type=AUTH_CAPTURE&x_first_name=FNAME&x_last_name=LNAME&x_email_merchant=TRUE "; curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); $buf = curl_exec ($ch); //execute post and get results echo($buf); curl_close ($ch); ?> -----END CODE----- Be sure to include the 'https://' in the curl_init() function. That is what tells the program that all the data should be encoded. Obviously, the '$data' variable holds all the post data and you can, of course, build this string on the fly with form data etc. Pretty simple once you know how to do it. Best regards, Jeremy Reed "David Johansen" <daveisfera@yahoo.com> wrote in message news:20020309191252.5680.qmail@pb1.pair.com... > Could someone tell me where I could get a basic Authorize.net example to > work off of. I'm sure that I could do it all from scratch, but a base to > start from would be nice and make it a lot faster. Thanks, > Dave > >

« previous php.general (#88026) next »