Passing Post Variables Using Fopen()
I'm trying to pull data from a website and read it into a file the I can parse. I've done the before to site without post variables but I can seem to get my statments to work with the post. Can someone help me out?below is the code I have so far.
$url="www.somesitethatneedspostvariables.com";
$postdata = http_build_query( array( 'postvarname1' ='value1', 'postvarname2' ='value2' ) ); $opts = array('http' => array( 'method' ='POST', 'header' ='Content-type: application/x-www-form- urlencoded', 'content' =$postdata ) );
$context = stream_context_create($opts); $file = @fopen($url, "r", $content) or die("Connection Error, Please contact Webmaster ERROR CODE=0xDEADBEEF");
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Passing Variables With POST
I have a file named login.php that basically just checks if a username and password are in a MySQL database. If they aren't then it shows access denied. If they are then I want to pass the $name and $pass to project.php in a different directory. Code:
Passing Variables In Frame Page By Post Method
Is it possible to send variables by post method through a submit button to a frames page, and have all 3 pages in the frame pick up the variable using the $_request[var] ?In other words, I click on a submit button. in form action method call index.php the index page has a top, main, and a left frame.how do i get each one of those to receive the variable, when i can only sendit to one page? or is it possible to send it to more than one page, but only action to one page?
Fopen Url With Using Post Variable
i'm using a php script opening en parsing a url like www.OpenThisURL.com/site.php?a=aa&b=bb this url and website are not mine but i'm only using some information from the site. now this site has changed and the GET variable a=aa & b=bb have changed into POST variable. (i know because before i go to that page i've to fill in a form and see that this form post method is POST) the script i used was something like this: $fp = fopen("www.OpenThisURL.com/site.php?a=aa&b=bb", "r"); $str = ""; while(! feof($fp)) $str .= fread($fp, 128); fclose($fp); how do i do something like that opening an url with some POST variable?
Passing Vars Using Post
How would you pass variables from one page to another page with a link using the post method?
Passing The POST To A Php File
I've an HTML form (contains 2 controls: input1 and input2) that call a php file (file1.php) using the post method. I need to call (from file1.php) another php file file2.php and pass the POST information to it so I can get the information in the $_POST array in file2.php. How can I do it?
Passing POST Information Without A Form
I have no clue if this is possible, and if it is, how to do it. Basically, I am creating a vote server system for my school, there is a central server with IIS, MySQL and PHP 5 on it, and I need to write all the pages that will get the information and display it, allowing the students to vote. I have the index page, which is nothing more than the login page, at least for now. When the student enters his / her student ID, the database checks if it exists by using this query: mysql_query('SELECT count(*) FROM `students` WHERE `snumber` = ''.$sid.'''); if the number is 1, the ID exists, if it is 0, it does not, simple. I will then transfer the person to vote.php, which will get the person's first and last name and display it at the top, then display all the vote information, and if they exist, poll questions as well. MY question is this, how would I go about transferring the person from index.php (where their student ID is validated) to vote.php where they will be allowed to vote, and also passing their student ID in a POST variable? I don't want to use vote.php to validate becuase I don't want the person to accidentally be able to vote without entering proper information. I also don't want to pass their student ID through GET for obvious reasons. IS there anything I can do?
Passing Sensitive Information Using GET Or POST
Basically, we have two websites which I need to pass information securely from one to the other. It is basically, login parameters and then conduct a search. I do not need to create a web service or any type of middleware solution at this time, I just need a quick and secure method of passing username/pass and the search parameters. I read a nice article (although old) that stated I could pass the data as follows, in either a cookie or a form variable. $encrypteddata = mcrypt_ecb(MCRYPT_TripleDES, "Secret key", serialize($data), MCRYPT_ENCRYPT); $encrypteddata = bin2hex($encrypteddata); $encrypteddata = hex2bin($encrypteddata); $data = unserialize(mcrypt_ecb(MCRYPT_TripleDES, "Secret key”,$encrypteddata, MCRYPT_DECRYPT)); (And yes, I do realize the mcrypt_ecb function is depreciated) However, I believe that with this solution, if I pass it in the URL, I could potentially use up the 2,000+ character limit. My question is, is there a better way to do this? Or different approach I could use?
Passing Variables & Dummy Variables
Hi! thanks for all the previous help - I've made some progress & have dropdowns and a checkbox; however I have 2 probs which I can't figure out: grateful for any further help. THANKS! 1. Not sure how to code so that user can query from just 1 or all of the dropdowns (at the moment unless they select the correct answers from each dropdown - no results!) = defeats the whole purpose of searching. By selecting from menu options user selects from 2 diff tables. [the page allows user to search catalogue by selecting year of release, artist, music type - results from 2 tables need to be selected & sent to mysql. I just don't know how to code it so that user must make an initial selection to get any results, and whichever menu options they choose "add them together" if you like to make a complete query.... sorry my coding just isnt deep enough! A friend suggested using a dummy variable but as I'm a bit out of my depth; I need to get some help! The coding I've done so far;
Passing Variables And Session Variables
I'm currently working on a shopping cart script that works just fine with register_globals turned on but when turned off i get all kind of errors. The following page displays a detail of the book with the "Add to cart" link at the bottom. PHP Code:
Passing My Variables With Forms Variables
how to carry variables onto the next page along with the forms variables. I need to carry my own over too, but when I press submit on the form page only the forms variables carry over, not my own ?? I have two drop down menues on my form that provide two values "start & end" which I require to go with my own variables.I have tried "a href=" link which carries my variables but not the forms variables. <?php echo"<form method=get action=somepage.php?one=$one&two=$two&three=$three&four=$four>";?> also tried <a href=somepage.php?one=$one&two=$two&three=$three&four=$four&start=$start&end=$end
Passing HTTP POST Information To Another Script - How?
I have a situation where I want to have multiple submit buttons on the same form and therefore want to use a redirection php script that checks the value associated with the submit form variable to calculate which submit was pressed and then redirects the user to another php page accordingly. I used: headers ("location:myphpscript.php") to do this. However automatically this does not pass on the information sent in the form POST. I did start looking into reencoding the $_REQUEST into a GET string to append to the URL, but this is a bit crude because the original form submit uses a post and had a lot of information (some of which is also held in $_FILES). So is there a better way to go about this? How can I simulate a POST? My second related question on this subject (I was going to post this separately but it's probably better here) is whether there is a limit to the amount of information that can be passed via an HTTP GET. I once remember reading there is a 255 character limit to a URL address and if this also includes the variable information after the ? this is quite restrictive.
Can't See My Post Variables
I work on an application which runs on our Intranet network, so security it's not a big issue, and my phpinfo() get me register_globals on (php 4.1.2 on a Debian system). The problems is that I can't see my post variables (only with $_POST) and I don't get it . Is there another setting wich overrides php.ini and stop my register_globals ->on to behave properly ?
With Variables And POST
On my online order form, I need to send a few variables to my credit-card processor. These variables are for non-secure customer comments, and will be sent through the usual metod, i.e., <form action="https://orderpage.ic3.com/hop/orderform.jsp" method="post"> However, one variable is a text-area box for a detailed customer comment, and this variable can get pretty long. But my credit-card processor has a 256 byte maximum length limit for all POSTed variables. However, I can add as many of these 256-byte variables as I like. So how can I accomplish this in the most simple, efficient, and elegant manner? How can I break up the text-area vaiable into 256-byte pieces and then send these variables via POST along with all of the other form variables which will be POSTed through the usual HTML means?
POST/GET Into Variables
how does this look? should this by me calling ... myforms = new forms(); work by turning all key/value pairs for both get and post into variable names of the same name as the get/post key, and the variable values as the values from the post/get? class forms { // Some stuff var $MyPosts; var $MyGets;...
Passing Variables
here is some of my code why wont it work it works when i replace $hello with $smith <input type="text" name="hello" value="smith"> <?php $db = mysql_connect("", "", ""); mysql_select_db("",$db); $result = mysql_query("SELECT first,last FROM employees where last='$hello'",$db);
Passing Variables
here's some code that's at the top of my page, a form later in the page posts the variables back to the same document and then updates the database. How do I make the page so that when the form is submitted it posts the info to the same page and then passes the same variables that were just put into the database to a page named view.php? or another way that would work was if there was a preview button next to the submit button that passed the variables, but the form action is set to PHP_SELF, so how would I make a button that would pass the form variables to view.php and not to itself? Here's the code PHP Code: <?php
Passing Variables
I am new to this and learning slowly, but I was hoping someone could give me some quick advice on how to create a variable on one page and have it passed to another to be read as an ID for a mySQL database. I want to pass the variable "varRevID" from one page and have it read as "reviews_id" on the other. My database is pulling from just the first record and I would liek to designate from the pointing page which record to pull from.
Passing Variables
Could somebody please give me a hint on the following problem. 1. I need to pass variables from one php file to another. 2. I need some few different forms and want to pass every variable to another (same) page.
PHP Not Passing Variables
I recently upgraded my PHP version to 4.3.4 from 4.1.2. There seems to be a problem when passing variables on a webpage. PHP does not respond to these requests. For example. index.php has data on the page. index.php?page=2 has different data. The page variable has been declared in index.php. However, since the upgrade, index.php shows the same data regardless whether page is defined or not. I have tried toggling Register Globals on and off and no effect. This is how page is declared: $page = $_GET['page']; I have two websites depending on this variable passing. Any suggestions?
Passing Variables Through The Url?
how can i display a certain row from a table by passing it's id through the url? like: http://site.com/page.php?id=13 i'm asking because i'm trying to paginate data with the infamous 'previous/next' buttons and i've found a bunch of scripts that work but don't quite solve my problem because they don't fetch the rows by their id, but rather by setting a number on a variable and then adding +1 or -1 to it. i guess this would work great if i didn't need to display the last record on my table first [using ORDER BY id DESC in the query, in which case the last record becomes #1, then the previous one #2, and so on]. so if i add another record to the table, people can't bookmark individual pages. so i'd like to make the whole prev next thing work using the id's on the table. how is this done? are there any tutorials out there that can help me with this? PHP Code:
Passing Variables
Example: A form has a variable called $test. When a user enters: this is a "test" for this variable input and then clicks 'Submit' the form posts to a new PHP program, the $test value being: this is a "test" This is correct as I have magic_quotes_gpc turned on. However I then have some error checking, and in the case of an error, the program performs a stripslashes() followed by a rawurlencode() on $test. This removes the slashes and allows the string to be passed back to the original program. $test now looks like: this%20%is%20a%20%22test%22 However what I don't understand is that when I examine $test back in the original program it now shows: this is a "test" I expected it still to look like: this%20%is%20a%20%22test%22 So I could simply use rawurldecode() before using it as a value inside the <input>.
Passing Variables
I allows users to enter data in a form. I process the form with a php file. I return control to another page on my website. I want to dynamical create the page that they are returned to so I can show them a copy of what they just entered. I cant get the syntax of this. My host is set to globals on and php 4. Example Form <FORM method="post" action="process_this.php" name="anmals" id="anmals" > <TABLE width="400" BORDER="2" CELLSPACING="0" cellpadding="4"> <td >Name</td> <td ><input type="text" size="45" name="realname" value= ""></td> </TABLE> </FORM> process_this.php $realname=$_POST['realname']; Header("Location: index5c.html") On index5c.html I want to use $realname to display the data the user entered on the form. There is something I am missing here as I am getting "null" back. I have tried various combinations of commands which I wont go into here. Can someone explain how I can pass the user data to index5c.html and display it.
Passing Variables
I'm passing variables through a $_POST. This string Ƈ^First Name^blah' gets passed through and comes out as Ƈ^First' (getting chopped at the space). I've done a lot of trouble shooting trying to find out where this string is being truncated but my question is, does any one know of any reason why $_POST would truncate this?
Passing Variables
I have the following code that passes the email variable. <meta http-equiv="refresh" content="4;URL=http://www.mysite.com/mypage.php?email=$email"> How do I pass two variables?
Passing Variables
When attempting to create a nice confirmation screen after a form is submitted, I used <input type=hidden name=variable value=$variable> type fields to pass the variables on to the next php script that processes, adds to mysql and writes a file.. Anyways, the hidden field only passes the first word, which I understand, but how to pass the entire variable without creating a temporary file that holds each variable.
Passing Variables........
I want to pass the variable $main from page 1 to page 2 to page 3. I can pass it from page 1 to 2 without problems i.e. Page 1 contains a form, which sends a variable $main to page 2. Page 2 then makes use of this variable. How do i then pass this same variable onto the 3rd page? (without storing the variable in a file/using cookies or anything complicated like that.....)
Passing Variables In 4.2.1
I just changed webhosts and I'm having all sorts of problems with my PHP scripts. Everything was working fine in 4.1.2 and lower - now I'm in 4.2.1 and having problems. Basically my script won't recognize variables passed via url nor will it pass variables through forms. Is this a problem in 4.2.1 or is there a PHP setup variable setting that will change this? I don't want to go back and change all my code, since I have several huge websites on the new server.
Passing Variables
I want to know how to pass variables across php scripts. Im thinking maybe I need to make them global variables but Im not sure. what i have is this. on page one there is a form for login/password with variables $login $password. when they click send it goes to a auth script...if the script auths that user in a database, it then goes to a redirect script which redirects users to a certain page based on the date. So my question is, how do I make $login available to the end page that the user is sent to. maybe $user = "$formlogin"; global $user;
Passing Variables
How do I pass variables in URLs? Something like link.php?id=5..... I am new to PHP and I have done variable passing similar to this scenario in CFML and ASP.
Passing Variables Between JS And PHP
I've got a bit of problem, with JS and PHP My trouble is, that i have a textbox with text in it. I want to send the text to a php. That php generates a MathMl syntax of the text, and I want to put the generated syntax in the place of the text in the textbox.
Passing Variables
I'm trying to have a variable passed from one script to the next, and I need to do it without including it in the url (via the ?variable='value'). The variable is populated in the first script when a person logs in, and if they are a supervisor the variable $isallowed is set to true. If they are not a supervisor $isallowed is set to false. The variable needs to be passed to a couple different pages that need to check and see if the person trying to access the page is logged in and a supervisor.
Passing Variables Via The URL
I am passing variables via the URL to some of my pages. I am aware of using sessions but I am dealing with integrating the payment processor Authorize.Net. Everything is working fine but I realize people can go to the URL and change the order id. Is there a way to encrypt this form the browser?
Passing Variables Via URL
I am passing my variables via the URL from page to page. This is base on dealing with Authorize.Net. However, here is my question. Can I do the following: $x = $_REQUEST['amount']; and then pass the $x via the url to another page like https://xxx.com/natHealing/view_gift.php?x
Passing Variables To More Than One PHP
im working on creating an online shopping website and wanna know if i can pass the same variable to more than one php? for example when the user selects products(products.php), they get printed on the next page where they select delivery type and address(checkout.php), after that i need to pass the same variable to the overview page where the user can see what he/she have ordered, where it is being dispatched to, the cost and the payment details!! im using $_GET['my var'] method at the moment and have action="checkout.php" in my products.php! and finally i want to do a client side check on whether any items have been selected when the user clicks on "continue button".
Passing Variables
I have a PHP file which grabs data from my SQL server and I need to pass it to another PHP file without using URL passing. Any ideas how I would do this?
Passing Variables Through A URL
Can anybody help me in trying to find out how i can go about passing variables through a URL? I have results echo'ed out onto a page and they are assigned a unique ID. Uusing that ID is there any way i can pass it through the URL into another page which will then recieve the variable and load all information out of my database associated with it?
Passing Variables
I have a link like this: $descr="I love New York"; a href=add_prod.php?descr=$descr; This only passes I and not the whole string of words.
Post Cookie Variables
I have a page that include on the top the result of a cookie (i come form a previous page with some inputs) in the second part of the page a form with name surname email etc etc On submit all the information (cookie + form) are sent by email... my problem is this: in the email doesn't appear the cookie values i try to create in the form tab a hidden fiel d with this value <input name="NewEoc" type="hidden" value="<?php echo $COOKIE['NewEoc'] ?>">
Variables Past By Get And Post
I'd like a generic include that goes at the top of all pages that mysql escapes the variables past to the script. Is there a way to refer to the each of the variables past, for example (in pseudo code): for(each $XX in (list of get/post variables)) { $$XX = mysql_escape_string($$XX); }
Empty Variables And 4.21 (POST/GET)
With global variables set to on, I always had the following in my script to make sure variables had a default value: if (empty($var)) { $var = 1;} Now with 4.21, I changed it to: if (empty($_GET['var'])) { $var = 1;} The problem is sometimes I use GET and sometimes I use POST. With global variables on it didn't matter. Now it does. Is there a way to do this? When I try if (empty($_GET['var']) || empty($_POST['var'])), it doesn't work because one or the other will always be empty at any one time.
Processing GET And POST Variables
Below is a function adapted from one found in phpMyEdit.class.php http://platon.sk/projects/release_l...hp?project_id=5 phpMyEdit is a form generator for PHP/MySQL. I think this function works great, especially for forms where data is redisplayed due to failed validation of user input. I wonder what the opinion of other PHP users would be. function get_cgi_var($name, $default_value = null) { // From the phpMyEdit project // Usage: $name = get_cgi_var('name'); static $magic_quotes_gpc = null; if ($magic_quotes_gpc === null) { $magic_quotes_gpc = get_magic_quotes_gpc(); } global $HTTP_GET_VARS; $var = @$HTTP_GET_VARS[$name]; if (! isset($var)) { global $HTTP_POST_VARS; $var = @$HTTP_POST_VARS[$name]; } if (isset($var)) { if ($magic_quotes_gpc) { if (is_array($var)) { foreach (array_keys($var) as $key) { $var[$key] = stripslashes(trim(strip_tags($var[$key]))); } return $var; } else { $var = stripslashes(trim(strip_tags($var))); } } } else { $var = @$default_value; } return $var; // If data is displayed/posted using htmlspecialchars($var) // return @$HTTP_POST_VARS ? html_entity_decode($var, ENT_QUOTES) : $var; }; $name = get_cgi_var('name');
POST Variables And Sockets...
I have a server that uses Cpanel, and my mail server is Cpanel's cppop. I am trying to create an email address. With an older version of Cpanel, you could use this command line through sockets. GET /frontend/x2/mail/doaddpop.html?email=emailaddress&domain=mysite.ca&password=emailpassword"a=10 HTTP/1.0 Authorization: Basic $pass That worked just fine because email addresses were created through GET variables. Now, they have changed it to POST variables. Now, I need to create an email address, while faking the following post variables: email domain password quota I know I need to use sockets, and pass the POST variables, but I have no idea how to.
Looping Thru POST Variables
I need to know how to loop thru the variables my script receives from a form with action=post. I need to build a list of only those variables that comes from my checkboxes.
POST Variables Not Coming Through
For some reason, at random posts, the post variables don't get thru to the server. For example, if there is are two text fields: name and email... (I have register_globals on)... When I try to update the database with a query and use $name, $email, the $name is missing or the $email is missing. I am building an intranet application and all the 20 or so clients run IE. This happens very rarely. Something like once in 100 updates. But I can see this in the log files as update contact set name="", email="asda@pol.com" where contact_id=918. Notice the name field is blank. I have JS checks in the client side which does not allow blank name field.. Is this an IE random error? How do I get over this?
POST Variables From Programs
we are trying to make a program in C++ that will comminicate with a PHP script. But we dont know how to get the variables from the program. We got it figured out with perl/CGI, but PHP seems to be a better way to connect to SQL server. On PHP the GET works, its easy, but it's not secure enough. I need informtion on what headers does the PHP require to get the POSTed data from a program.
|