Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Fill A Form Authenticated HTTPS


I'm searching all around the web without any good answer, maybe you have
the right one.

I'm trying to fill&send a form on a site authenticated https via curl.
The problem is simply that it doesn't arrives to authenticate..
It returns id error1 -> unsupported protocol.

The code is the following:

<?php
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

$login_url = "https://www.my_site.com/login";
$login_data = "username=my_user_name&password=my_pass";
$form_url = "https://www.my_site.com/form";
$form_data ="input1=walla&input2=test";

$ch = curl_init($login_url);

curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_COOKIEJAR, "curl_cookies");
curl_setopt($ch, CURLOPT_COOKIEFILE, "curl_cookies");
curl_setopt($ch, CURLOPT_POSTFIELDS, $login_data);

$body = curl_exec($ch); // login

curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_URL, $form_url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $form_data);

$body = curl_exec($ch); // get form results

echo "error curl_errno ($ch) <br>"; //it return error id1
curl_close($ch);
?>




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Fdf Fill Out A Form
I followed the instruction of http://fooassociates.com/phpfer/html/rn20.html

I know how to fill in the data into a form on the browser of the client.
Is it possible to fill out the form on the server and to send this as a
pdf file to the client?

Fill In Form Fields On PDF
Looking for classes or libraries which allow you to fill in form
fields on a PDF document.

Autmatic Form Field Fill
I have two fields in a form. The first is the email field the second is the username.
Now I want the username field to be filled automatically with the part before "@" of the first field.
So if someone fills in "brain@domain.com" the second field has to be filled with "brain".

Create And Fill-in Form From MySQL
I am working on an admin page where a user can input data into two text fields. When the the form is actioned the two fields are inserted into a table as a row.

What I want to do is when the user calls up the form, any rows that exsist in the table are inserted into the text fields. So the user will see x number of rows with the text fields on the form (x number being number of rows in table). The data is listed in order as determined by the MySQL query. At the end I want to add two blank text fields.

The user can then edit the data in the text fields which updates the appropiate row or enters data into the bottom (blank) text fields which adds a new row.

This is the query I have to call the data PHP Code:

Passing Variables To Fill A Form
how can I send variables from a php page to a form - i need to fill the form with these variables? maybe using (the process of passing variables to other pages - through url) but how can i assign them to form variables ?

If 10 Clients Fill Out A Form On My Page Simultaneaously And Hit Submit
If 10 clients fill out a form on my page simultaneaously and hit submit, how
does my (Apache2.0.50/PHP4.3.8) server exactly ensure each gets 'their own'
completed form returned ? Or is it possible the clients get mixed up under
some conditions?

Dynamic Fill Form Fields Depending On Dropdown Box
This question has probably already been asked, but let me ask again

I have a mysql database to which I connect with my php scripts. The
database contains articles. Name, Unit_Price and Reference

Now my client needs to order 5 items, click a button and a table with 5
lines and 3 columns appears (until now easy)

In the first column is a drop down box with a <select > and <options> in
which I store all possible names.

I would like than whenever the client changes one of the boxes (in my
case there are 5) the Unite_Price column and Reference column in the
line he just choose get automatically updated

Losing Posted Form Fields Over Https
This has been driving me nuts. I have an application running for several
clients. Some run on http and two run on https. Two weeks ago, the https
customers started occassionally getting kicked out to the home page. This
is not every time, it's generally 1 in 10 form posts. Refreshing the page
asks you to repost the info and it posts as it should have in the first
place. Dumping the $_SERVER variable shows me that if things go well I get
the $_POST and $_GET variables and the $_SERVER["CONTENT_LENGTH"] is a
number. When the error shows up, CONTENT_LENGTH=0 and there are no $_POST
or $_GET variables.

I can only reproduce this over https on Linux/Apache/PHP using Internet
Explorer. I cannot reproduce it using Mozilla or Opera as a browser. And I
also can't reproduce it using IE over https with Windows/IIS/PHP. None of
the PHP code changed and there were no new installations on the server I can
point to as a possible cause.

We were running PHP v4.1.1 and upgraded to v4.3.4. I have been able to trap
the condition to offer our users a page to inform them to refresh so they
won't lose their data.

Any suggestions, ideas, places to look or ask more questions, is much
appreciated.

$_SERVER[SERVER_SOFTWARE] => Apache/1.3.20 Sun Cobalt (Unix) mod_ssl/2.8.4
OpenSSL/0.9.6b PHP/4.3.4 mod_auth_pam_external/0.1 FrontPage/4.0.4.3
mod_perl/1.25

Sending An Https Post Request Without A Form
I'd like to send a post request to an https server, but without using a form.  Specifically, I want to send the contents of my internal shopping cart (stored in a session variable) to a paypal cart.  I don't want to use a form, simply because I dont want to have to use hidden fields with all the pertinent data.  I'd like to set up the post request, and execute it in the background without it being presented to the user, simply have the user redirected to the paypal site afterwards. 

basically, I have it set up to the point where I have the parameters stored in a variable, I just need to send that along to https://www.paypal.com/cgi-bin/webscr.  I've tried a bit with fopen and such, but Im running apache on windows, and don't have SSL installed, and haven't really been able to find much information on doing that.  What I want is just to have it do the same thing it would do if it was a form with a submit button.

Only Allow Authenticated User
how could i make my php pages to be viewed only by authenticated users? note: my index.php has the prompt for authentication. but if i put something like http://www.mydomain.com/otherpages.php - they would be able to get-in without even logging in. How could i avoid this ?

Authenticated In Both JSP And PHP At The Same Time After Loggin In Once?
We have two rather large web apps, one written in JSP and the other in PHP. We would like the users of these apps to be able to log into the JSP app (or PHP app, it doesn't matter to me which app they log into first) and be authenticated in both the JSP and the PHP application. Can anyone think of an easy way to do this?

I know that PHP has support for using Java classes but I do not know enough about Java to know if I can some how use PHP's Java support to solve this problem. We'd like to avoid having to port the PHP application over to JSP if we can help it.

Keeping A User Authenticated
I've looked through most threads here about user authentication against a mySQL database, but I still have not figured out how to "keep" the authentication as the user browses through the restricted pages.

Sessions and cookies seems to be involved, but I still don't understand how it is implemented and checked when a user goes to a different page after being authenticated. I got as far as authenticating the user against the database, but then...

Authenticated File Uploads
I've got a requirement that a group of users should be able to upload
files to an area on my system. I want these users to be authenticated by a
php form secured by ssl. Each user will have an Email address in an include
file, and when the file upload is complete an email will be sent to that
user and to myself alerting that a file has been received. Does anyone have
such a configuration? I'd like to do this without a database if possible, my
needs are not that elaborate.

SMTP Authenticated Server
I have this small script that is supposed to send an email. I have configured my local php.ini file to point to my SMPT remote server. The problem is that my SMTP Remote mail server requires authentication. I need to use this particular SMTP server. How can I do this?

Check If User Has Authenticated
I've got a web site that has a mix of public and private sections.
When you first come to the site, the final option on the menu is
"Private" which forces an authentication and then gives you an
expanded menu that includes all the private sections of the site.
What I'd like to do is give users the proper menu ("public only" or
"public and private") depending on whether they have authenticated
with the site.

I thought of just checking for $_SERVER["REMOTE_USER"] or
$_SERVER["PHP_AUTH_USER"] but if you are on a public page, those don't
exist whether or not you have authenticated with the private sections.
I was hoping not to have to deal with sessions or cookies but is that
the only option I have? Or is there some value somewhere that will
tell me that a user has authenticated and that is available (to PHP)
even in the public areas?

How To Secure Downloads For Authenticated Users?
I have files on my Apache web server that are NOT in publicly accessible space.
I want to make these files available for download only to authenticated users.

I currently use a download script that is accessed from an SSL-encrypted page
(that the user arrives at after authenticating). There are links in this page
that initiate the different file downloads by passing a variable (name of the
directory and file) to the download script.

It works fine, but if someone were to guess the full path of the file on the web
server, the download could be initiated without coming from the SSL-encrypted
page. I could check referrer, but I'd rather not rely on that.

How can I ensure that my download script is only initiated from the encrypted
page?

Here is the download script (which IS in publicly-accessible space):

$info = trim($_GET['fileinfo']); //a 'directory.filename.extension' is passed
in
$info_array = explode(".", $info);
$directory = $info_array[0]."/";
$filename = $info_array[1].".".$info_array[2];
$extension = $info_array[2];
$dlfile = "/home/user-directory/private-data/".$directory.$filename;
header("Content-Disposition: attachment; filename=".$filename);
header('Content-type: application/'.$extension);
header("Content-Length: ".filesize($dlfile));
readfile($dlfile);

If someone were to enter a URL like this:

http://www.example.com/download-scr...tory.myfile.zip

then all the SSL is for nothing...

I could use htaccess to protect the directory that the download script is in,
but that means the user has to authenticate twice when trying to download
something.

And if I try to do this:

session_start();
if ($_SESSION['uid'] == "valid_user")
{
//execute script
}
else
{
exit;
}

the download barfs.

How do I make my downloads secure?

Debugging An Authenticated Mail Function
My email server requires authentication, so I wrote (stole) some code that used the fsockopen()/fputs() functions to open a connection and write what I need manually to the smtp server.

It worked fine for months, but we changed our network a bit and now the mail function I wrote works on one machine, but not on the webserver. I added in some error checking, but they return nothing.

I would be grateful if someone could let me know the best/easiest way to debug this code and find out why I'm not sending email anymore: PHP Code:

If A User Is Authenticated Via Htaccess Or Php Session..
If a user is authenticated via htaccess or php session, is there a way to have the other authentication system know so a second login is not required?

So, for example, if someone is logged into htaccess, then PHP would know and not request another login.  Or, if one was logged into a php session, htaccess would be able to tell, and not require another login.

Redirect From Http To Https And Then Back To Https To Http
I need help with redirect from http to https when I user click on register.php and abter he completes the form I want to redirect back to http.

Textarea Fill
I need an idea on how to accomplish this task. I have a script that I tried so many times to tweak but failed; so I am starting afresh. I am working on a project with PHP and MySQL and the table below is one of the tables in the db.

title_duty
id int not null auto increment
title varchar(255)
duty text

The table are populated with titles and their duties.
I need a php form with a dropdown menu of the titles of which when a user selects a title, the corresponding duty of the selected title, will display on a text area in the form; where the user can edit the duty. Now the form output can either be submitted to another table for selection with another form or can be a POST in another form. Any ideas on the best way to solve this nagging problem?

Please Fill Out This Web App Development Survey
I work for a start up
company that is working out of a basement to develop a new app
framework to assist developers in writing apps that contain complicated
business rules. I'm tasked with gathering market data that we can
present to potential investors.

The survey is targeted at experienced web app developers with both
business and technical knowledge.

The survey will take about five minutes, and is located here:

Auto Fill Forms?
Is it possible to auto fill form with your information.

Example:
https://login.yahoo.com/config/mail?.intl=us

Can I Log into there with my username and password from a php file and check if the word anoluck exist.

Seach And Fill Textbox
can someone point me in the direction of script that will search a database and will offer a drop down that populates with the search results that can be selected to fill the textbox. 

Php Array Used To Fill In A Web Page
I know how to use php/mysql to fill in a page with information, but I read
a little about arrays and i think this may be an interesting and easy way
to maintain a small website. My idea is to have all the titles, descriptions, etc in one php document...

Fill $_FILES Argument From XML Parser
I've a function asking for a $_FILES argument:

function insertarticle($particle,......,$pUserID,$pOptions, $files){
in this function I do add the record and then save the files in a
subdirectory specific on some datas.

This function is used by my "insert" form, letting the user to select images
files to upload with <FILE> html tag.
The files to upload are then passed to the $files like this:
insertarticle(1884,......,4,$Options,$_FILES);

for mantainance purpose, I avoid as much as possible to have the same code
in 2 different pages. Also, using actually this function to add a record in
the database (quite complex code) and saving files from a form, and using
the same function to add records from an XML parser, I can't send images
files to the function.

My parser can save the images files on the server's directory, but how to
pass $files parameters in order to save those files ? It's there any way to
take the string containing the base64 image code (I do actually save it
locally) and put it in a $_FILES array for passing it to the function ?

How Do I Fill Config.inc.php3 PHPMyAdmin?
I'm trying to install PHPMyAdmin in mysql. I have a f2s account and need to administer my dbs, after I fill it with server, user and pass the config and run localhost/../indexphp3 it try too run (many errors are in my browser):

1- left side displays phps scrips
2- getright bigings to download php.exe
3- other that I didnt remember now....

How do I fill config.inc.php3 PHPMyAdmin correctly?

$cfgServers[1]['host'] = ''
$cfgServers[1]['port'] = ''
$cfgServers[1]['adv_auth'] = false;
$cfgServers[1]['stduser'] = ''
$cfgServers[1]['stdpass'] = ''
$cfgServers[1]['user'] = ''
$cfgServers[1]['password'] = ''
$cfgServers[1]['only_db'] = ''
$cfgServers[1]['verbose'] = ''

I'm using Apache, MySql and Php4 and are working ok.

Fill A Array From ODBC Connection
I have a database access to which access through an ODBC connection. I wonder how can I fill in an array with the "Select" launched to the database. Thank you....

Print Table Cells To Fill In The End Of A Calendar
I have a variable called $rowCount that keeps track of how many total cells have been added to a table. Its actually the month view of a calendar. I need to print blank cells representing the days of the next month to fill in the cells and make the grid complete. I am almost there, I just need to figure out how to make it stop printing new cells when the $rowCount variable becomes divisible by 7. That would mean that all table rows have 7 columns, and the grid is complete. here is what I tried so far, but this just keeps printing the cells, never stopping. PHP Code:

Variable Passing To Script To Fill Html
I'm trying to do the above in order to process an image and return the
result to an html image control. It fails and my key suspects are either
the variable that I'm passing in - ImageName - for processing, or the return
data which is done (or not as the case may be) by imagejpeg($img) in the
script, after header("Content-type: image/jpeg").

Script To Automaticly Fill In Fields On A Website
I have a website that me and my friends need to vote on every day.  It has one field, the email field, and one field a image verification that you have to type in.  What I would like to do is have a script that looks opens the webpage in a new window, populates the email address from a database, then repeats for each name in the database.

That is really all it has to do, I can go and do the image verification myself, it would be nice to have something that can do that too.

Newbie Question: How Do I Fill A Table With Data From Mysql
I have a database that i hook into using php and I want to create a loop
that will create a table an populate it with data from the table but I
really am at a loss on how to achieve this.

Select From Drop List To Fill Table Column With Text -- HOW ?
I want viewers to compare state laws on a single subject.

Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the column below.
The viewer can select states from the drop down lists above the other two
columns as well. If the viewer selects only one, only one column fills. If
the viewer selects two states, two columns fill. Etc.

I could, if appropriate, have a separate htm page with the text for each
state -- california.htm for example. When the viewer selects California from
the drop down list, the column below would "fill" with California.htm.

Or, I could conceivably use a text or mysql database with two fields for
each record: state_name and law_text -- but it would probably be easier to
use separate htm files, since there will only be about 20 states involved,
and the "database" would never have a large number of records.

The table width would be 100% and each cell would be @33%

My site is designed with FP 2002 and runs on Apache/FreeBSD. I have just had
Apache-ASP installed but I have not yet configured or used the module.

PHP Value For HTTPS
I am installing a “CubeCart” (On a dedicated server), my cart and DB work fine however when I try to get cranked on the HTTPS/SSL. I create an endless loop
I did run a test

<?php
echo $_SERVER["HTTPS"];
// if return 0 my php environment doesn't give a value for
// $_SERVER["HTTPS"]
?>

It returned 0
Reason is that it looks like the server/php doesn't have a value for that variable then it will never detect it and CubeCart will go into a continious loop.

HTTPS
Are there any tutorials/cookbooks on getting https to work? I've been
through the openssl-php doc page, and seem to have all the dll's in the
right place (at least, when I enable the openssl extension in the php.ini,
I don't get any complaints). Looking at the openssl.org howto's, it looks
like there should be an openssl binary around somewhere to create keys.
Does that come with PHP or just with openssl? (Downloading openssl is
easy, but if there's a copy with php that I missed, I'd rather use one that
was compiled with it).

Right now, if I do https://mywebsite, I get page can not be displayed -
server not found or dns error (i actually use the IP, so I can pretty much
rule out a dns error, and the server is there and works with http.)

Https
How does one use this? Is it simply setting a variable or calling a function
or is it completely different from http(i.e., is it transparent? Do I need
to do anything significantly different than what I do in http?)

Now what are the cons of using it rather than http? Right now I'm using http
but wondering if I should use https for any reasons or not.

What Is HTTPs
I have a PHP program that runs on Apache and connects to MySQL. The network administrator told me that they will block HTTP and allow HTTPS, will that cause a problem with my application?

The administrator will install the certificates, do I need to change the code? The database is hosted on the same server too.

HTTPS
I have read in a couple of places that a form on a page under the HTTP layer will still encrypt data before sending if the action of that form points to HTTPS.  My question is 'Is this true?'.

Surely the client and the server need to exchange the public and private keys before any encryption can take place or does the client and server set up the keys first and then send the data?

Fill Fields When User Selects User From DB
I have a field with a selectbox which contains a list of client names and several other fields which display information from the DB.

I need to be able to make the fields change to the appropriate information when a user is selected from the select box. Can anybody please give me an example of a bit of code that will do this?

Http Or Https ??
What variable might i be able to extract the http:// or https:// from to detect which type it is?

On my server i have $_SERVER['SCRIPT_URI'] which contains htis but my friend does not have this variable on his server.

Posting XML Using HTTPS
I need to post an xml string to another server using HTTPS (secure Socket Layer) protocol. On another server i need to get this data and extract it from binary to a string again. does anybody knows where i can find some information (articles) on this topic?

PHP As Https Client
We are just getting started on a project that involves our host
Windows/Apache2.2/PHP5 server communicating with a second server using
the https://username:password@xxx protocol.

I'm new to PHP. Can someone tell me what is going to be involved in
doing this?

Force Https
I want to make sure people are on the secure version of a page (https). If a person is on the regular http, how can I force them to go to https?

$_POST And Https?
I have a script that displays and accepts form data. It has been working fine in my sandbox. When I move the script to the production area (same server, same version PHP, etc.) which is https, the form stops working.

I put in a print_r($_POST); on both locations of the script. The one in the original location has values in the $_POST after form submission. The one in the https location has no values in the $_POST after form submission. I diff'd the files. They are identical.

REMOTE_ADDR Via HTTPS
I am having a small problem with a script that has to be requested via
https.

When I execute this normally I get my IP address printed on the
screen:

<?php
echo getenv('REMOTE_ADDR');
?>

However the same script executed over https gives me a completetly
different address.

How to I read the clients IP address via https?

PHP, SOAP And HTTPS
I am creating a webservice in PHP, but the results that the web service returns is confidential - what is the most secure way to ensure the data being returned is secure? My thinking is the following:

* Encrypt the data myself in the actual webservice
* The webservice must reside in a secure area and be accessed via HTTPS

Is there anything else I could use - any better ideas?

Upload On Https
I am trying to upload some files on a secure connection. The code
works perfectly when executed on http but errors out on https. I am
using move_uploaded_files to transfer the files. The directory to
which I am uploading is on http (contains images).

Header() With Https
if there is a clean way of using https with header() in PHP ? I am
using statements like header("Location: script.php?arg1=argvalue") to
transfer control in my application.

Https And Move_uploaded_file
I have a php script under https directory that is trying to move a local file from the desktop to an https directory using move_uploaded_file. It does not work....but if i move it to a http directory...it works just fine. I wanted the https so that i could easily force a password.

The error is simply a warning that it cannot write the file...php does not give any other hints. The prompts come up correctly and lets you run the script...but then nothing but the error. Any ideas or am I missing something about https and move_uploaded_file?

HTTPS Authentication
On my current project i have requirement to do HTTPS user authentication.
'Till now i 've been doing authentication using sessions and checking login
and pass against MySql. Can you give me some info on authenticating users
via HTTPS, what are the requirements, can i use my existing scripts etc.


Copyright © 2005-08 www.BigResource.com, All rights reserved