That's what I originally thought but I was unable to get their system to authenticate my requests.
I was using a action post cfhttp with all of the parameters I thought they were looking for but the only thing returned to me was a connection error.
They of course don't know Coldfusion and I don't know much about cURL. I'm trying to figure out how to get it done but my Google searches don't come up with much info.
Thanks for your question though...
There is much information in the cURL FAQ. Here is a sample cURL procedure to grab a web page.
First, download cURL. I am on Windows, so I downloaded one of the binaries for Windows. I created the folder c:\curl_7_18_0 and extracted the zip file into it, such that the path of the curl application is c:\curl_7_18_0\curl.exe. I then ran a Coldfusion page containing the following code
<cfexecute name = "C:\curl7_18_0\curl.exe"
arguments = " http://www.adobe.com/"
timeout = "20">
done page grab!
When I double-click on the file C:\curl7_18_0\adobePage.html I duly get the Adobe page.
Thank you BKBK with that code I know that my cURL set up is correct and I'm usng the cfexecute correctly.
Now with my code below can I get information or am I going about things in the wrong way? This is a crudely done code snippet to show what I'm thinking of. Right now I get no errors and all I return is a blank page.
Do away with the cfsavecontent and see what you get with something like this:
outputFile = "C:\temp\Stuff.txt"
It has zero sense to use cURL while you have CFHTTP available.
Thank you BKBK. I tried what you mention and all I received was a stuff.txt file that had nothing inside it.
Mr. Black. I was originally trying to use CFhttp and I think that would be a great way to do it. The problem I had was that it wasn't getting authenticated on their end. I had the code all set up and I used the cfhttpParams for their x_usernames and what not. I am waiting for them to e-mail me their logs so I can see what their end says is a problem.
But until then I thought I would try to use the tech they use, cURL, of which they have a lot of experience. Which doesn't really help me but I have to try something while I wait.
Mr Black wrote
It has zero sense to use cURL while you have CFHTTP available.
Not zero. Knowledge makes sense.
Experiment by placing the URL at the end, thus:
>>t has zero sense to use cURL while you have CFHTTP available.
>Not zero. Knowledge makes sense
O-o-ops, sorry. I was wrong. It has negative sense. There is nothing that you would be able to do with cURL and couldn't do with CFHTTP, except that you would have MUCH larger overhead with cURL (from all points of view: performace, reliablility, resources, amount of code written, etc.).
Mr Black wrote
It has negative sense. There is nothing that you would be able to do with cURL and couldn't do with CFHTTP, except that you would have MUCH larger overhead with cURL (from all points of view: performace, reliablility, resources, amount of code written, etc.).
You miss my point about knowledge. By your reasoning, it makes no sense to be able to do arithmetic using pencil and paper when one can simply reach for the calculator.
There is a funny edge to this. You seem to know quite a bit about both cURL and CFHTTP. That is what enables you to weigh the pros and cons. Yet you want to discourage Lankeeone from gaining that knowledge.
The very first sentences of this thread tell us that Lankeeone is new to cURL and wishes to learn more about it. That itself is a worthy purpose.
Sorry for the late reply I was out of the office for a while. Mr. Black I totally understand that cfhttp would be the perferred method to use in this situation. I would love to use it, but I can't get working with their system. While I await more clarification to the problems their system has with my requests I'm trying to get something done. The bosses want it done.
The third party company knows cURL and doesn't know Coldfusion.
Just for myself if I include a cfhttpparam in a cfhttp is would be like including it as a <input type hidden> in a regular form correct?
is roughly the same as saying
<input type='hidden' name="x_username">
BKBK I will try your example soon and get back to you with the results.
Thanks for everyone's comments. I do appreciate them all.
> Just for myself if I include a cfhttpparam in a cfhttp is would be like
> including it as a <input type hidden> in a regular form correct?
> <cfhttp method="post">
> <cfhttpparam name="x_username">
> is roughly the same as saying
> <form method="post">
> <input type='hidden' name="x_username">
Actually it <cfhttp...> is exactly the same as the <form...>. It is
also the same as
<input type="text" name="x_username">
<input type="radio" name="x_username" value="foo">
<input type="checkbox" name="x_username" value="bar">
The point here is that all these form controls are only for the browser
interface. Once the form is completed the action http request simply
contains a set of name-value pairs.
BKBK, I tried the code that you put in this thread and I got a blank text file. Nothing in it at all. No errors either.
I've talked to the third party company and they said to try to use my cfhttp with http instead of https. I did that and I now get a response from their system. I do have two questions though.
1) Why does the http work and not the https? I am using Coldfusion 7 right now.
2) They return information like this
I am receiving an "incorrect number of columns in row" error now. I think it's due to the fact that they have broken up the returned information. So the 1,0 is the first row and only is two columns so when Coldfusion gets to the second row and sees five columns it doesn't like it.
Though I could be incredibly wrong on that as well.
Thank you for all of your help and comments.
> BKBK, I tried the code that you put in this thread
> and I got a blank text file. Nothing in it at all.
> No errors either.
I have succeeded in reproducing the scenario of a blank output file. The following two points stood out:
1) Confirm that the URL you are using is actually that of the action-page of the form.
2) Verify whether the action-page has validation code like
If so, then you will have to include &abracadabra=some_value in the data string. Otherwise the output may be blank.
Ask the webmaster.
> I am receiving an "incorrect number of columns in row"
> error now. I think it's due to the fact that they have
> broken up the returned information. So the 1,0 is the
> first row and only is two columns so when Coldfusion gets
> to the second row and sees five columns it doesn't like it.
I think so too. Coldfusion tried to build a query from the data, using the comma as delimiter, but the carriage return creates two rows with an unequal number of columns.
What happens when you leave out the name attribute from the cfhttp tag? Then Coldfusion wouldn't need to create a query.
edited: text block separated into 2 paragraphs
Ok, seriously? Do you guys claim to know anything about curl/cfhttp and dare say that you can do anything with cfhttp you can do with curl?
Authorization: <your authorization header here>
Content-Type: multipart/related; boundary="END_OF_PART"
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq">
... doc contents here ...
Even something simple like the above requires you to write the xml away to the drive _just_ to get it to work with cfhttp... and this is a ridiculously staightforward request. Next if you start looking at the uploading api's and more it requires you to manually define http params on the multipart level which seems impossible to control. This kind of stuff tends to be _simple_... with cfhttp you spend hours just to get it to work by chance.
Wow, holy angry thread resurrection Batman!