Re: [PHP] No Reply From cURL
At 11/21/2002 11:55 AM, greg R wrote: I don't think cURL is very intuitive. Well, I'm glad to see someone else say that. Makes me feel less retarded. Can you at least echo a response code from your function, such as $res = curl_setopt($ch, CURLOPT_URL, https://partners.netledger.com/SmbXml;); echo $res; That should at least tell you, if nothing else, that you could successfully get into the service. If it's a success, should return a 1, I think. Thanks Greg, that's a start. Yes, it's returning a 1. So where do I go from here with troubleshooting? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Reply From cURL
I had a devil of a time figuring out how to make it work. After searching the archives and lots of other sites I came up with the following code: (FYI - I am using authorize.net, so some of the response parameters may be different for you) HTH Bret ?php $data = formfield1_name=formfield1_valueformfield1_name=formfield1_value/*etc*/; # gets static data merchant info, login, password etc if($x_Method==CC){ $data .= formfield3_name=formfield3_valueformfield4_name=formfield4_value/*etc*/; #gets conditional values if Credit Card is selected } else{ $data .= formfield5_name=formfield5_valueformfield6_name=formfield6_value/*etc*/; #gets conditional values if eCheck is selected } $ch = curl_init(https://secure.website.net/script_or_application;); // URL of gateway for cURL to post to $data .= x_First_Name=$x_First_Namex_Last_Name=$x_Last_Namex_Company=$x_Company; $data .= x_Address=$x_Addressx_City=$x_Cityx_State=$x_Statex_Zip=$x_Zipx_Phone=$ x_Phone; //$data = gets the rest of all form data curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // use HTTP POST to send form data curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) $resp = curl_exec($ch); //execute post and get results curl_close ($ch); //My responses are delimited with | (pipe) $parts = explode(|, $resp); //creates array from reponse ? - Original Message - From: Steve Keller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 2:03 PM Subject: [PHP] No Reply From cURL I apologize for being a pest about this, I'm just not getting it. I'm attempting to open a connection to NetLedger to post an XML file. I'm attempting this basic code, which is pretty much what I find everywhere: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, https://partners.netledger.com/SmbXml;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$postData); $result = curl_exec ($ch); curl_close($ch); echo $result; And I'm getting no result back so I can't even see what error I'm getting. I'm using PHP 4.2.3, with OpenSSL/0.9.5a and compiled as follows: './configure' '--with-apxs=/usr/local/www/bin/apxs' '--with-mysql=/usr/local/' '--with-gd=/usr/local/' '--with-freetype' '--with-imap' '--with-curl' Also, how do I include a file in the postData? Can someone point me to a good page about HTTP where I can read about doing that? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Reply From cURL
-- snip - Thanks Greg, that's a start. Yes, it's returning a 1. So where do I go from here with troubleshooting? -- snip - That is cURL returning a (true) value having completed succesfully. Bret - Original Message - From: Steve Keller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 3:20 PM Subject: Re: [PHP] No Reply From cURL At 11/21/2002 11:55 AM, greg R wrote: I don't think cURL is very intuitive. Well, I'm glad to see someone else say that. Makes me feel less retarded. Can you at least echo a response code from your function, such as $res = curl_setopt($ch, CURLOPT_URL, https://partners.netledger.com/SmbXml;); echo $res; That should at least tell you, if nothing else, that you could successfully get into the service. If it's a success, should return a 1, I think. Thanks Greg, that's a start. Yes, it's returning a 1. So where do I go from here with troubleshooting? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Reply From cURL
-- snip - Well, I'm glad to see someone else say that. Makes me feel less retarded. -- snip - Took me 3 weeks on and off and several handfulls of hair ; ) - Original Message - From: Steve Keller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 3:20 PM Subject: Re: [PHP] No Reply From cURL At 11/21/2002 11:55 AM, greg R wrote: I don't think cURL is very intuitive. Well, I'm glad to see someone else say that. Makes me feel less retarded. Can you at least echo a response code from your function, such as $res = curl_setopt($ch, CURLOPT_URL, https://partners.netledger.com/SmbXml;); echo $res; That should at least tell you, if nothing else, that you could successfully get into the service. If it's a success, should return a 1, I think. Thanks Greg, that's a start. Yes, it's returning a 1. So where do I go from here with troubleshooting? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] No Reply From cURL
I suspect your problem is that CURL is not built with SSL support. To test this, replace the https:/.../ with a reference to a non-SSL URL (http://.../). If you get a return that, you need to build CURL with SSL support. -- JR -Original Message- From: Steve Keller [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 14:04 PM To: [EMAIL PROTECTED] Subject: [PHP] No Reply From cURL I apologize for being a pest about this, I'm just not getting it. I'm attempting to open a connection to NetLedger to post an XML file. I'm attempting this basic code, which is pretty much what I find everywhere: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, https://partners.netledger.com/SmbXml;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$postData); $result = curl_exec ($ch); curl_close($ch); echo $result; And I'm getting no result back so I can't even see what error I'm getting. I'm using PHP 4.2.3, with OpenSSL/0.9.5a and compiled as follows: './configure' '--with-apxs=/usr/local/www/bin/apxs' '--with-mysql=/usr/local/' '--with-gd=/usr/local/' '--with-freetype' '--with-imap' '--with-curl' Also, how do I include a file in the postData? Can someone point me to a good page about HTTP where I can read about doing that? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Reply From cURL
At 11/21/2002 03:18 PM, Bret L Conard wrote: Really appreciate the help Bret. But I've still got some problems: (FYI - I am using authorize.net, so some of the response parameters may be different for you) Actually, I appreciate the fields demonstration because it made me realize I was missing two fields from the post, although Netledger is our accounting system, not the payment gateway, so I was able to dump the CC and eCHECK junk from the code since that's already been processed and written into the data file. We're using PayflowPro, and I've set up their Silent Post to feed to a script on our site that generates an XML file in NetLedger's Small Business XML format based on the data returned by PayFlow, and only if the purchase is approved. It's that XML file that I need to post, along with two identifying fields. NetLedger is then supposed to take that uploaded XML file and turn it into a sales record in our accounting. Does anyone know how to work a file into a cURL post? I've already tested the XML file numerous times (NetLedger has a way to upload the XML files from your desktop), and I know it's formatted properly. $ch = curl_init(https://secure.website.net/script_or_application;); // URL Ok, I was setting the URL in a CURLOPT. From what I understand, that shouldn't make a difference, right? //My responses are delimited with | (pipe) $parts = explode(|, $resp); //creates array from reponse Where are you setting this? Ok, I've taken a shot at using your example and just removing the CC stuff. What I came up with, then, should work, right? Nope. Still no response. Here's my code: $data = mtype=XMLDOCoutfile=true; $ch = curl_init(https://partners.netledger.com/SmbXml;); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $resp = curl_exec($ch); curl_close ($ch); $parts = explode(|, $resp); echo resp: .$resp.br /; echo parts: .$parts.br /; foreach($parts as $key = $val) { echo b$key:/b $val br\n; } Now, granted, I'm not using | as a delimiter. At least, I don't think I am. Still, $resp should echo if there's something in it, right? What I get out of that is: resp: parts: Array 0: Parts is the only one that echoes as I expected it to. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: RE: [PHP] No Reply From cURL
At 11/21/2002 05:16 PM, Jonathan Rosenberg wrote: I suspect your problem is that CURL is not built with SSL support. To test this, replace the https:/.../ with a reference to a non-SSL URL (http://.../). If you get a return that, you need to build CURL with SSL support. Indeed it does. :( I had thought I compiled it correctly, but as I've already demonstrated, my knowledge in the area is far from complete. Let this be a lesson to all web department managers: if your lead programmer becomes a pothead hypochondriac and goes on disability, don't put the graphics guy in charge. Thanks for the help all. I'll try to read up on how recompile cURL correctly, see if I can't discover where I went wrong. Couple questions, however: 1. I'm assuming I'll have to recompile PHP once I do this? Or will a change in cURL not affect it? 2. Still confused on appending files to posts, so any help on that would also be appreciated. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Reply From cURL
//My responses are delimited with | (pipe) $parts = explode(|, $resp); //creates array from reponse Where are you setting this? How I set up at Authorize.net didn't expect yours to be... one of these should work to import the file The following options expect a file descriptor that is obtained by using the fopen() function: CURLOPT_FILE: The file where the output of your transfer should be placed, the default is STDOUT. CURLOPT_INFILE: The file where the input of your transfer comes from. as in: curl_setopt($ch, CURLOPT_INFILE, fileName.XML); Bret - Original Message - From: Steve Keller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 5:49 PM Subject: Re: [PHP] No Reply From cURL At 11/21/2002 03:18 PM, Bret L Conard wrote: Really appreciate the help Bret. But I've still got some problems: (FYI - I am using authorize.net, so some of the response parameters may be different for you) Actually, I appreciate the fields demonstration because it made me realize I was missing two fields from the post, although Netledger is our accounting system, not the payment gateway, so I was able to dump the CC and eCHECK junk from the code since that's already been processed and written into the data file. We're using PayflowPro, and I've set up their Silent Post to feed to a script on our site that generates an XML file in NetLedger's Small Business XML format based on the data returned by PayFlow, and only if the purchase is approved. It's that XML file that I need to post, along with two identifying fields. NetLedger is then supposed to take that uploaded XML file and turn it into a sales record in our accounting. Does anyone know how to work a file into a cURL post? I've already tested the XML file numerous times (NetLedger has a way to upload the XML files from your desktop), and I know it's formatted properly. $ch = curl_init(https://secure.website.net/script_or_application;); // URL Ok, I was setting the URL in a CURLOPT. From what I understand, that shouldn't make a difference, right? //My responses are delimited with | (pipe) $parts = explode(|, $resp); //creates array from reponse Where are you setting this? Ok, I've taken a shot at using your example and just removing the CC stuff. What I came up with, then, should work, right? Nope. Still no response. Here's my code: $data = mtype=XMLDOCoutfile=true; $ch = curl_init(https://partners.netledger.com/SmbXml;); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $resp = curl_exec($ch); curl_close ($ch); $parts = explode(|, $resp); echo resp: .$resp.br /; echo parts: .$parts.br /; foreach($parts as $key = $val) { echo b$key:/b $val br\n; } Now, granted, I'm not using | as a delimiter. At least, I don't think I am. Still, $resp should echo if there's something in it, right? What I get out of that is: resp: parts: Array 0: Parts is the only one that echoes as I expected it to. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Reply From cURL
At 11/21/2002 06:21 PM, Bret L Conard wrote: one of these should work to import the file The following options expect a file descriptor that is obtained by using the fopen() function: CURLOPT_FILE: The file where the output of your transfer should be placed, the default is STDOUT. CURLOPT_INFILE: The file where the input of your transfer comes from. as in: curl_setopt($ch, CURLOPT_INFILE, fileName.XML); Thanks. I was using INFILE before. Just wasn't sure if that was right. However, I've managed to narrow down my problem to cURL not compiling correctly. I had compiled it before through a vinstaller and it used the default ssl directory, which isn't where OpenSSL is located. So I downloaded a new copy, configged it with the right directory, and ran a make test on it. And all my HTTP and HTTPs connection tests failed. So now I'm off to bother the people on the cURL mailing list and find out what's going on. Thanks for the help. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php