473,795 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cURL form submission without button + hand over control

1 New Member
I've spent HOURS searching the net for an answer to this, but can't find it...

I trying to send data using the POST method and also have the control of the browser be turned over to the website that's receiving the POST data (note that this is NOT the same as sending the data via POST method and then redirecting to the website after). I need it to work exactly like hitting the submit button on an html form, and I need it to work from PHP. It needs to POST the data to the site and also let the other site have control at the same time.

I've tried a couple of methods using both cURL and an fsocket function, but it seems like in both cases that (1)the data gets sent to the other site first, (2) then my program gets a response back, (3) and then it redirects to the other site after.

Here's my cURL example:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
  3.     $url = 'https://www.xyz.com/xyz.exe/xyz-AddItem';
  4.     $part1 = 'SB123';
  5.     $item1 = 'blue socks';
  6.     $qty1 = '1';
  7.     $price1 = 5;
  8.     $dat = "PartNo=".$part1."&Item=".$item1."&Qty=".$qty1."&price=".$price1."&";
  9.     $ch = curl_init();
  10.     curl_setopt($ch, CURLOPT_POST,1);
  11.     curl_setopt($ch, CURLOPT_POSTFIELDS,$dat);
  12.     curl_setopt($ch, CURLOPT_URL,$url);
  13.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  1);
  14.     curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  15.     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  16.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
  17.     $result=curl_exec ($ch);
  18.     curl_close ($ch);
  19.     echo("Results: <br>".$result);
  20. ?>
Somehow I think it needs to redirect (hand over control) when the curl_exec function is called, because this is when the data would be POSTed (but I'm not an expert, so not sure).

Is there a way to terminate my php program AND hand the browser over to this other site AND pass the data over using the POST method?

Any help would be appreciated.
Thanks
Jul 13 '07 #1
0 1593

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2022
by: Tom | last post by:
I have created the following code for a product select/payment form (don't know if there is a better way) and I have been trying to make the following changes (unsuccessfully so far): 1) Eliminate the submit button and submit the form with onchange. 2) Open the action php page in a new window. I am using this code for different payment options (i.e., cc processing and paypal). As such, there are multiple forms on the page. The...
19
3001
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or a method for the form?. If I give it an empty action <form action="" ..... it validates OK. Is this acceptable or is there a better/standards correct way? Thanks.
2
1906
by: Brian | last post by:
On a photographer's web site, I have a catalogue page that lists all the photos available for purchase. It is marked up as a table, with 1 column for the image title, a second for the material on which it's printed. http://www.julietremblay.com/portfolio/catalogue.html I want to convert this into the first part of an order/inquiry form, so I added a third column with a checkbox. A user can then select the photo(s), press a submit...
5
6090
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the Internet. Specifically, marking up a document that will contain multiple related form controls (intended exclusively for client-side scripting) that would never be intended to be submitted. I realise that that concept is a non-starter in an Internet...
3
4344
by: John Dunlop | last post by:
(Note crosspost and follow-ups to ciwah.) Nicolas Keller wrote in thread "Differences in form handling btw Mozilla and IE?": > The problem: I'm using a form that submit's (POST) its data via three > different image buttons (depending on which button you click, > something different should happen): > > <form action="id.php" method="post" name="form2">
2
7043
by: Andy Goldstein | last post by:
I have a table where all the TRs have an onClick handler registered. One (and only one) of the rows has 2 text input boxes, where each textbox has an onChange handler registered. Both the onClick and onChange handlers do some minor manipulation of form data (although they work on different form elements). If the onChange event fires, I need the form to be submitted. If the onClick event fires for a TR, I also need the form to be...
6
6399
by: nick4soup | last post by:
I have read the CGI FAQ 'How can I avoid users hitting "submit" twice' (on http://www.htmlhelp.org/faq/cgifaq.3.html#19 ) which essentially says you have to detect it at the server, using a hidden form field. That's fair enough. My server is therefore processing a response on the first request, so what kind of HTML response should I send out on the second, duplicate,
4
2737
by: kschneider | last post by:
Assume there's a form with it's action attribute all set to post to a URL, but without a submit control. Form submission is done via a link and I want to prevent the classic "double submit". Ignoring the server side of things, does anyone see any holes with the following script? It seems to work, but I'd appreciate other eyes on it. Maybe a try/catch/finally wrapper of some sort to be sure the link is re-enabled in the face of an...
1
1844
by: devranger | last post by:
I have used curl_setopt($ch, CURLOPT_POST, true); and curl_setopt($ch, CURLOPT_POSTFIELDS, $data); on post forms to retrun results, but what about a GET Form Method? How do you deal with these with curl? The same commands? The particular instance I am dealing with is a store locator and it is not as easy as just calling the url with the variables becasue it runs some script behind the scene that does a bunch of calculations for...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7543
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.