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: -
-
$startOfRecord.="\n";
-
-
$startOfRecord.= $domainInserted.". IN A 202.131.92.114
-
www.".$domainInserted.". IN A 242.141.22.114
-
mail.".$domainInserted.". IN A 242.141.22.114
-
mail.".$domainInserted.". IN MX 21 242.141.22.114";
-
-
//echo($startOfRecord);
-
-
-
//#%@%#@%#@%@#% Part 2 #@%@%@#%@#%@#%@#%
-
-
-
$my_data = array (
-
'index' => $$indexOfZone,
-
'view' => '',
-
'text' => $startOfRecord,
-
'submit ' => 'Save'
-
);
-
//$my_data[upfile] = "@$file";
-
-
-
$data_string = '';
-
$add_ampersand = FALSE;
-
foreach ($my_data as $key => $value)
-
{
-
if ($add_ampersand)
-
{
-
$data_string .= '&';
-
}
-
$data_string .= $key . '=' . $value;
-
$add_ampersand = TRUE;
-
}
-
-
$curl_handle = curl_init ();
-
-
// Tell CURL the URL of the CGI
-
curl_setopt($ch,CURLOPT_POSTFIELDS,$my_data);
-
curl_setopt ($curl_handle, CURLOPT_URL, 'http://202.131.92.114:10000/bind8/save_text.cgi?'. $data_string);
-
-
// This section sets various options.
-
// See http://www.php.net/manual/en/function.curl-setopt.php
-
// for more details
-
curl_setopt ($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
-
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
-
-
-
//Option for http authentication into Webmin
-
curl_setopt($curl_handle, CURLOPT_USERPWD, "username:******");
-
// Perform the POST and get the data returned by the
-
// server.
-
$result = curl_exec ($curl_handle) or die ('There has been an error');
-
-
//Closes the CURL handle
-
curl_close ($curl_handle);
-
-
Please help if possible :)
Thanks
Al
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". -
$my_data = array (
-
'index' => $indexOfZone,
-
'view' => '',
-
'text' => $startOfRecord,
-
'submit' => 'Save'
-
);
-
Hope this helps
Al
Atli 5,058
Expert 4TB
Hi Al.
Glad you found a solution!
Thanks for sharing it with us.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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:...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |