473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Using curl_setopt to post to an encrypted Form

Please help,

I am having trouble using curl_setopt to post to an encrypted form.

The form values are
<form action=save_text.cgi method=post enctype=multipart/form-data>

I have isolated the problem to being the enctype. Anyway here is my code:

Expand|Select|Wrap|Line Numbers
  1.  
  2.     $startOfRecord.="\n";
  3.  
  4.         $startOfRecord.= $domainInserted.".        IN      A        202.131.92.114
  5.         www.".$domainInserted.".    IN      A       242.141.22.114
  6.         mail.".$domainInserted.".   IN      A       242.141.22.114
  7.         mail.".$domainInserted.".   IN      MX      21 242.141.22.114";
  8.  
  9.         //echo($startOfRecord);
  10.  
  11.  
  12.                         //#%@%#@%#@%@#%        Part 2        #@%@%@#%@#%@#%@#%
  13.  
  14.  
  15.                         $my_data = array (                            
  16.                                     'index' => $$indexOfZone,    
  17.                                        'view' => '',
  18.                                     'text' => $startOfRecord,
  19.                                     'submit ' => 'Save'
  20.                         );
  21.                     //$my_data[upfile] = "@$file";
  22.  
  23.  
  24.                     $data_string = '';
  25.                     $add_ampersand = FALSE;
  26.                     foreach ($my_data as $key => $value)
  27.                     {
  28.                         if ($add_ampersand)
  29.                         {
  30.                             $data_string .= '&';
  31.                         }
  32.                         $data_string .= $key . '=' . $value;
  33.                         $add_ampersand = TRUE;
  34.                     }
  35.  
  36. $curl_handle = curl_init ();
  37.  
  38. //    Tell CURL the URL of the CGI
  39. curl_setopt($ch,CURLOPT_POSTFIELDS,$my_data); 
  40. curl_setopt ($curl_handle, CURLOPT_URL, 'http://202.131.92.114:10000/bind8/save_text.cgi?'. $data_string);
  41.  
  42. //    This section sets various options.
  43. //    See http://www.php.net/manual/en/function.curl-setopt.php
  44. //    for more details
  45. curl_setopt ($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
  46. curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
  47.  
  48.  
  49. //Option for http authentication into Webmin
  50. curl_setopt($curl_handle, CURLOPT_USERPWD, "username:******");
  51. //    Perform the POST and get the data returned by the
  52. //    server.
  53. $result = curl_exec ($curl_handle) or die ('There has been an error');
  54.  
  55. //Closes the CURL handle
  56. curl_close ($curl_handle);
  57.  
  58.  
Please help if possible :)

Thanks

Al
Sep 7 '07 #1
2 2232
Ok the solution that worked for me is.

Basically use this

curl_setopt($curl_handle,CURLOPT_POSTFIELDS,$my_da ta);


And $my_data is basically an array with the Form inputs you want to "POST".


Expand|Select|Wrap|Line Numbers
  1.     $my_data = array (                            
  2.                           'index' => $indexOfZone,    
  3.               'view' => '',
  4.                   'text' => $startOfRecord,
  5.                   'submit' => 'Save'
  6.                         );
  7.  
Hope this helps

Al
Sep 7 '07 #2
Atli
5,058 Expert 4TB
Hi Al.

Glad you found a solution!
Thanks for sharing it with us.
Sep 7 '07 #3

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

Similar topics

1
by: GluedToTheScreen | last post by:
I have a small PHP ecommerce site set up using Authorize.net's SIM (simple) interface. Working fine, but... I'd like to implement their AIM interface (so visitor's will never see the gateway's...
4
by: Marek Möhling | last post by:
I'd like to redirect visitors to a remote location sending post values. Using: ================================================================ $ch = curl_init(); curl_setopt($ch,...
12
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt...
1
by: Rory | last post by:
I'm just starting to use cURL and having trouble accessing https pages. All I want to do at this stage is get an https page and display it, just to test the https get is working. However, I always...
13
by: princei2007 | last post by:
hi, iam just a beginner with php and curl.i search a lot but not able to find out the find out the problem i am gating. I am first sending data to a php a file then using CURL on the php file iam...
8
by: princei2007 | last post by:
I want to creat a weblogin client using php to login to this forum or someother. but i am gating with the page that u have to login befor precede. I am new to curl so cannot figure out where the...
2
by: shotokan99 | last post by:
hi, i wanted to accomplish these task: 1. from that webservice get a certain set of strings from the header 2. next, generate the image. and these 2 steps will be done at the same time. to...
1
by: iriu | last post by:
I'm using an account at betamax to send sms and they give me a link to send sms throught my site. Link:...
3
by: buzz2050 | last post by:
Hi all, I am using cURL for the first time. I need to login to a site and my cURL code to do the same is as follows: //curlScript.php <?php function getContent($url, $referer,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.