<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Error trying to post to external URL AND redirect in GF</title>
		<link>https://legacy.forums.gravityhelp.com/topic/error-trying-to-post-to-external-url-and-redirect-in-gf</link>
		<description>Gravity Support Forums Topic: Error trying to post to external URL AND redirect in GF</description>
		<language>en-US</language>
		<pubDate>Wed, 22 Apr 2026 01:28:31 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/error-trying-to-post-to-external-url-and-redirect-in-gf" rel="self" type="application/rss+xml" />

		<item>
			<title>Dana Cobb on "Error trying to post to external URL AND redirect in GF"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/error-trying-to-post-to-external-url-and-redirect-in-gf#post-50329</link>
			<pubDate>Thu, 23 Feb 2012 12:17:53 +0000</pubDate>
			<dc:creator>Dana Cobb</dc:creator>
			<guid isPermaLink="false">50329@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Nice. Glad you got everything working!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>copysmith on "Error trying to post to external URL AND redirect in GF"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/error-trying-to-post-to-external-url-and-redirect-in-gf#post-50325</link>
			<pubDate>Thu, 23 Feb 2012 12:11:41 +0000</pubDate>
			<dc:creator>copysmith</dc:creator>
			<guid isPermaLink="false">50325@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Sorry... solved the problem several days ago by placing the cURL code on the confirmation page. Yes, the confirmation page is a redirect with a full URL.  Here's what I had as the hook:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;#39;gform_after_submission_1&#38;#39;, &#38;#39;post_to_act_on_form&#38;#39;, 10, 2);
function post_to_act_on_form($entry, $form) {

if (!function_exists(&#38;#39;curl_init&#38;#39;)) {
error(&#38;quot;Curl is not setup on this PHP server and is required for this script&#38;quot;);
}
else {
$row_arr = array();
$row_arr[&#38;quot;First Name&#38;quot;] = stripslashes($entry[&#38;#39;11.3&#38;#39;]);
$row_arr[&#38;quot;Last Name&#38;quot;] = stripslashes($entry[&#38;#39;11.6&#38;#39;]);
$row_arr[&#38;quot;E-mail Address&#38;quot;] = stripslashes($entry[&#38;#39;12&#38;#39;]);
$row_arr[&#38;quot;Quiz1&#38;quot;] = stripslashes($entry[&#38;#39;13&#38;#39;]);
$row_arr[&#38;quot;Quiz2&#38;quot;] = stripslashes($entry[&#38;#39;14&#38;#39;]);
$row_arr[&#38;quot;Quiz3&#38;quot;] = stripslashes($entry[&#38;#39;15&#38;#39;]);
$row_arr[&#38;quot;Quiz4&#38;quot;] = stripslashes($entry[&#38;#39;16&#38;#39;]);
$row_arr[&#38;quot;Quiz5&#38;quot;] = stripslashes($entry[&#38;#39;17&#38;#39;]);
$row_arr[&#38;quot;Quiz6&#38;quot;] = stripslashes($entry[&#38;#39;18&#38;#39;]);
$row_arr[&#38;quot;Quiz7&#38;quot;] = stripslashes($entry[&#38;#39;19&#38;#39;]);
$row_arr[&#38;quot;Quiz8&#38;quot;] = stripslashes($entry[&#38;#39;20&#38;#39;]);
$row_arr[&#38;quot;Quiz9&#38;quot;] = stripslashes($entry[&#38;#39;21&#38;#39;]);
$row_arr[&#38;quot;Quiz10&#38;quot;] = stripslashes($entry[&#38;#39;22&#38;#39;]);
// Post to Act-On form
$ch2 = curl_init();
if (curl_error($ch2) != &#38;quot;&#38;quot;) { echo &#38;quot;Error: $error\n&#38;quot;;}

// Point to Act-On External Post URL
curl_setopt($ch2, CURLOPT_URL, &#38;quot;http://www.actonsoftware.com/acton/eform/1854/0003/d-ext-0001&#38;quot;);

// Set the method to POST
curl_setopt($ch2, CURLOPT_POST, 1);

// Pass POST data
curl_setopt($ch2, CURLOPT_USERAGENT, getenv(&#38;quot;HTTP_USER_AGENT&#38;quot;));
curl_setopt($ch2, CURLOPT_POSTFIELDS, http_build_query($row_arr, &#38;#39;&#38;#39;, &#38;#39;&#38;amp;&#38;#39;));
curl_exec($ch2);
curl_close($ch2); // close cURL resource
}
}
add_action(&#38;#39;gform_after_submission_1&#38;#39;, &#38;#39;post_to_act_on_form&#38;#39;, 10, 2);
function post_to_act_on_form($entry, $form) {

if (!function_exists(&#38;#39;curl_init&#38;#39;)) {
error(&#38;quot;Curl is not setup on this PHP server and is required for this script&#38;quot;);
}
else {
$row_arr = array();
$row_arr[&#38;quot;First Name&#38;quot;] = stripslashes($entry[&#38;#39;11.3&#38;#39;]);
$row_arr[&#38;quot;Last Name&#38;quot;] = stripslashes($entry[&#38;#39;11.6&#38;#39;]);
$row_arr[&#38;quot;E-mail Address&#38;quot;] = stripslashes($entry[&#38;#39;12&#38;#39;]);
$row_arr[&#38;quot;Quiz1&#38;quot;] = stripslashes($entry[&#38;#39;13&#38;#39;]);
$row_arr[&#38;quot;Quiz2&#38;quot;] = stripslashes($entry[&#38;#39;14&#38;#39;]);
$row_arr[&#38;quot;Quiz3&#38;quot;] = stripslashes($entry[&#38;#39;15&#38;#39;]);
$row_arr[&#38;quot;Quiz4&#38;quot;] = stripslashes($entry[&#38;#39;16&#38;#39;]);
$row_arr[&#38;quot;Quiz5&#38;quot;] = stripslashes($entry[&#38;#39;17&#38;#39;]);
$row_arr[&#38;quot;Quiz6&#38;quot;] = stripslashes($entry[&#38;#39;18&#38;#39;]);
$row_arr[&#38;quot;Quiz7&#38;quot;] = stripslashes($entry[&#38;#39;19&#38;#39;]);
$row_arr[&#38;quot;Quiz8&#38;quot;] = stripslashes($entry[&#38;#39;20&#38;#39;]);
$row_arr[&#38;quot;Quiz9&#38;quot;] = stripslashes($entry[&#38;#39;21&#38;#39;]);
$row_arr[&#38;quot;Quiz10&#38;quot;] = stripslashes($entry[&#38;#39;22&#38;#39;]);
// Post to Act-On form
$ch2 = curl_init();
if (curl_error($ch2) != &#38;quot;&#38;quot;) { echo &#38;quot;Error: $error\n&#38;quot;;}

// Point to Act-On External Post URL
curl_setopt($ch2, CURLOPT_URL, &#38;quot;http://www.actonsoftware.com/acton/eform/1854/0003/d-ext-0001&#38;quot;);

// Set the method to POST
curl_setopt($ch2, CURLOPT_POST, 1);

// Pass POST data
curl_setopt($ch2, CURLOPT_USERAGENT, getenv(&#38;quot;HTTP_USER_AGENT&#38;quot;));
curl_setopt($ch2, CURLOPT_POSTFIELDS, http_build_query($row_arr, &#38;#39;&#38;#39;, &#38;#39;&#38;amp;&#38;#39;));
curl_exec($ch2);
curl_close($ch2); // close cURL resource
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Dana Cobb on "Error trying to post to external URL AND redirect in GF"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/error-trying-to-post-to-external-url-and-redirect-in-gf#post-50269</link>
			<pubDate>Thu, 23 Feb 2012 00:56:14 +0000</pubDate>
			<dc:creator>Dana Cobb</dc:creator>
			<guid isPermaLink="false">50269@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, copysmith,&#60;/p&#62;
&#60;p&#62;I need just a bit more information. Is the redirect within Gravity Forms setup in the admin? Do you have the Confirmation as a Page or Redirect with a full URL? I did some testing on my end and didn't have that error. I setup a post like the example on this page (&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#60;/a&#62;) with my Confirmation set as a redirect.&#60;/p&#62;
&#60;p&#62;Can you supply the code you put into the gform_after_submission hook?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>copysmith on "Error trying to post to external URL AND redirect in GF"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/error-trying-to-post-to-external-url-and-redirect-in-gf#post-49643</link>
			<pubDate>Thu, 16 Feb 2012 19:30:13 +0000</pubDate>
			<dc:creator>copysmith</dc:creator>
			<guid isPermaLink="false">49643@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I added 'gform_after_submission' function to post the form data to an external URL. I used cURL to do the post.&#60;/p&#62;
&#60;p&#62;It works perfectly as long as I don't ALSO redirect the user within GF to another page. If all I do is show a message, the external post works fine. Once I add the redirect to another URL in GF, I get an error message: &#34;Cannot modify header information - headers already sent&#34;, and it points to the line in the GF code: &#34;header(&#34;Location: {$confirmation[&#34;redirect&#34;]}&#34;);&#34;&#60;/p&#62;
&#60;p&#62;I'd like to post the form data to an external URL (Act-On) AND then redirect the user to a different page. &#60;/p&#62;
&#60;p&#62;Ideas?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
