Forums

How to post to Feedblitz Web Services?

aef03 12 Jan, 2010
Can anyone tell me how to post to webservices from ChronoForms? I need to post an XML document - it is the only API provided by Feedblitz.

Thanks,
D.
GreyHead 12 Jan, 2010
Hi aef03,

You can probably do it with the cURL plugin, or with the Joomla XML-RPC library - though I'm not sure what the settings would be.

I also found this snippet at FeedBlitz that suggests that a straight-forward cuRL repost might do it.

Bob
aef03 15 Jan, 2010
Bob,
Do you mean I can do it with the cURL plug-in you have without coding?

It seems posting XML via cURL requires that the data base stored in an XML file which is posted - is there a way to do that?

Thanks for finding the info on their website - they did not point me to that when I inquired via email, so I emailed them again to find out if that information is still current.

Do you have a URL to the actual webpage it was a part of?

Thanks,
D.
GreyHead 15 Jan, 2010
Hi aef03,

Here's the link to the page the snippet came from - it's aimed at WordPress but should work on any site.

You can build an XML file save it and send it - but it's quite a bit of work for a newsletter subscription. If the cURL solution will work that's worth testing first.

Bob
aef03 27 Jan, 2010
I have been working with the folks a FeedBlitz to see if the cURL plugin can work without resorting to XML. I have followed their instructions, but I get the attached cURL error when doing so.

I have a couple questions:
1) Has anyone seen this problem on IIS and resolved it? (I have already googled the errors and found some possible solutions - I'm looking for any solutions specific to getting this working with Chrono)

2) I have my form set for POST, does that mean the cURL also does POST?

Thanks,
D.
[attachment=0]Feedblitz via chronoforms 2.png[/attachment]
GreyHead 27 Jan, 2010
Hi aef03,

I wonder if it's as simple as adding a final / to the URL.

I don't see why IIS should make a any difference as this is presumably a message back from the FeedBlitz server.

The form POST/GET setting doesn't link through to the plugin.

I'm pretty ignorant about cURL but I think the default is GET; the plugin uses CURLOPT_POSTFIELDS to send the data.

The PHP Manual entry on this page says

The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. This can either be passed as a urlencoded string like 'para1=val1ΒΆ2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data.



Bob
nml375 27 Jan, 2010
Hi aef03 & Bob,
The 405 HTTP response-code with IIS usually means the currently requested document or document type isn't explicitly permitted to use any other method than GET (or possibly HEAD). Most often, the document has an improper extension, or the URL is pointing to the wrong file.
From what I can see in the previously posted image, the target url should be:

http://www.feedblitz.com/f/f.fbz?AddNewUserDirect not http://www.feedblitz.com/f or http://www.feedblitz.com/f/

To get technical, IIS requires any document being accessed through POST to have a Script Mapping setup for the document extension. This is part of IIS security features to avoid accidental Serverside Execution of scripts or programs.

/Fredrik
aef03 27 Jan, 2010
Fredrik,
I had success getting past the 405 using the url http://www.feedblitz.com/f/f.fbz?AddNewUserDirect, but I receive the attached error about a valid email. Maybe it's coughing on the encoding of the "@" in the email address?

Also, do you know if AddNewUserDirect requires additional forms to be completed on the Feedblitz site or will it just send the opt in message ?

Thanks!
D.
[attachment=0]feedblitz valid email.png[/attachment]
nml375 27 Jan, 2010
Hi aef03,
I believe this error is caused because you've got the wrong names for the form entities:
The email "output" should be named EMAIL, not newsubscriber, and the listid should be named FEEDID, not listid.

/Fredrik
aef03 27 Jan, 2010
OK, found the problem with my most recent post. newsubscriber=email@email.com was something special for this direct access method (that does not require more forms to be completed on feedblitz). I needed to use email=email@email.com to get this form to use AddNewUserDirect.

Since there are more forms on Feedblitz that are supposed to be completed when using AddNewUserDirect, the subscription cannot be completed.

However, I think this will allow feedblitz to compare the two pieces of backend code to see if there are differences that are causing the error.
aef03 27 Jan, 2010
Found out the trailing "&=" was due to a carriage return in the cURL plugin's field "Extra fields Data"
aef03 27 Jan, 2010
Feedblitz is asking if CURL is sending the http referrer (CURLOPT_REFERER). Does anyone know if the plug-in automatically sends this header?
nml375 27 Jan, 2010
Hi aef03,
The plugin does not set any referer-data, so I would assume Curl will not send any Referer-header.

/Fredrik
GreyHead 27 Jan, 2010
Hi aef03,

It doesn't look like it. Here's the code that builds the query from line 273 in the plugin file.
        $query = JURI::buildQuery($curl_values);

        $messages[] = '<b>cf_CURL debug info</b>';
        $messages[] = '$curl_values: '.print_r($query, true);
        $messages[] = '$params->target_url: '.print_r($params->get('target_url'), true);
		$ch = curl_init($params->get('target_url'));
		$messages[] = '$ch: '.print_r($ch, true);
		curl_setopt($ch, CURLOPT_HEADER, $params->get('header_in_response')); // set to 0 to eliminate header info from response
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
		curl_setopt($ch, CURLOPT_POSTFIELDS, $query); // use HTTP POST to send form data
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		$response = curl_exec($ch); //execute post and get results
		curl_close ($ch);
It woudl probably be easy to add the extra line.

Bob
This topic is locked and no more replies can be posted.