Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-18-2007, 02:29 AM   #1 (permalink)
tableman
Junior Member
 
Join Date: Aug 2006
Posts: 9
Default cURL not working

A form has entries like this:

Code:
<input type="text" name="first_name" size="24" /> <input type="text" name="last_name" size="24" /> <input type="hidden" name="must_have" value="12345" /> <input type="hidden" name="recipient" value="myemail@comcast.net" /> <input type="hidden" name="redirect" value="http://mywebsite.com" /> <input type="hidden" name="subject" value="Topic In Question" />

When the action in the form is set to go directly to the receiving file like this:

Code:
<form method="post" action="http://theirwebsite/receive.jsp" name="goodname">

everything works. The entries are received by http://theirwebsite/receive.jsp.

However, I need to use a separate file to send the form entries, so the form action is set like this:

Code:
<form method="post" action="http://mywebsite/separate.php" name="goodname">

Code in http://mywebsite/separate.php is like this:

Code:
<?php $siteUrl="http://theirwebsite/receive.jsp/"; $variablesToPost = array ( "first_name", "last_name", "must_have", "recipient", "redirect", "subject" ); $postData= array(); foreach($variablesToPost as $variable) { $postData[] = $variable . '=' . htmlspecialchars($_REQUEST[$variable]); } $postData = encodeQueryString(implode('&', $postData)); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $siteUrl); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_exec ($curl); curl_close ($curl); ?>

All hidden fields required by the destination file are in the form and listed in the array.

Something must be wrong with the code because the values are now not received by http://theirwebsite/receive.jsp.
tableman is offline   Reply With Quote
Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 10:37 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums