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




Calling A Post Script From A Post Script; Curl Works But ...


I am trying to call a php script B from script A.

However, when I do this with curl everything works fine except the url of the script is the url of script A. How can I make the URL the URL of script B.

Is this possible with curl?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
HTTPS Post Without Curl?
I am wondering if it is possible to use fsocketopen() to post data through HTTPS. There are a couple of threads that suggest that it is a possiblity, but others that refute this. Does the browser actually do any encryption? I am just wondering if it is a matter of encrypting the data correctly, if OpenSLL would work.

CURL + POST Method
I am currently coding a small script to put data to other website by "curl" this web site cgi script. OK, now let me introduce some backgrounds. The PHP variable of the url of the CGI script on that site is: $url = "http://www.example.com/index.cgi?";

Original CGI on that example.com site read the form data data_a and data_b in <input type=text> and <input type=textarea> by POST method. Two data I need to fill to this CGI script by my PHP script are: Code:

CURL, Header & POST.
How can I make a redirection (like a header('Location:/xxx') ) with
post values ?

HTTP POST With CURL
I'm receiving post from various vendors...and I'm trying to send a response back to them saying whether I received the post sucessfully or not. My thoughts were to use CURL. I'm not totally clear as to how I should handle this but this is what I did.

I collected the info posted to one page then via CURL I redirected the information to another page that says wether or not the the post was successful and based on wether it was successful or not then the script is redirected to a confirmation page.

My biggest issue is I'm trying to send a response to the server that posted to me saying wether or not the post was successful.

Curl And XML Post To Suppplier
I have been having problems with an xml post to a suppliers website. i was getting a returned "Document Error", but after reading this post.

I have now got past one problem and i am now faced with another after adapting the code posted in the above link.

This time my error is "Wrong Number of Lines, or Line missingLINE ERROR".

I have contacted the supplier and they said the xml I sent to them in an email was correct, but as they dont know php they couldnt help me with why I was getting this problem.

here is the full code i am using:

$request = '<?xml version="1.0" standalone="yes"?>
<order>
<header>
<securitycode>testcode</securitycode>
<orderref>TEST IGNORE</orderref>
<orderdatetime>'.date("m/d/Y H:i:s").'</orderdatetime>
<daterequired>'.date("m/d/Y").'</daterequired>
<deliveryaddress>
<deliverycontact>MR Smith</deliverycontact>
<deliveryname>Smith Shops</deliveryname>
<addressline1>addressline1</addressline1>
<addressline2>addressline2</addressline2>
<addressline3>addressline3</addressline3>
<addressline4>addressline4</addressline4>
<postcode>AA1 1AA</postcode>
</deliveryaddress>
</header>
<line>
<lineno>1</lineno>
<tlcpartno>PF7SS320</tlcpartno>
<quantity>10</quantity>
</line>
</order>'

// Create Headers
$header[] = "Host: www.supplierswebsite.com";
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($request) . "
";
$header[] = $request;

// Send using CURL
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://www.supplierswebsite.com/getxml.asp?action=ORDER&account=testing"); // URL to post
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$result);

$result = curl_exec( $ch ); // runs the post
curl_close($ch);

echo $result; // echo reply response

as mentioned above, the $result returns - "Wrong Number of Lines, or Line missingLINE ERROR"

any ideas where i am going wrong?

Maintaining Session After POST With CURL
Here's what I want to do: When a user enters in some data that is invalid, I send them back to the page they just left with all values still in tact... pretty simple, right?
I'm trying to use cURL (if there's a better way, let me know). The code I'm using is:
PHP Code:

Secure Post With PHP And Curl (to Paypal IPN)
I have 2 problems, 1 of which is tied to PHP and 1 loosely tied, so
I'll put this out there.

Got a problem that I have been working on for a while now which
involves implementing the Paypal IPN. I am using PHP 4 to automatically
post back to Paypal and I am using curl package.

I am doing a Custom request and would like to know if anyone has
successfully posted data back to paypal with curl and got something
other than INVALID back. I am always getting INVALID!! :(

I am doign EVRYTHING they tell me to.. ie ordering the parameters and
adding the cmd=_notify-validate

I guess I have 2 questions:

1. Am I using curl properly with this paypal interface or is there
something I am not setting.
2. Has anyone a working version with HTTPS/curl/paypal. I am using the
https://www.eliteweaver.co.uk/testing/ipntest.php to test this.

The code is as follows:

// put all POST variables received from Paypal back into a URL $post =
array();

foreach ($this->paypal_post_vars as $field => $value) {
array_push($post,$field."=".rawurlencode(stripslashes($value)));
}

array_push($post,"cmd=_notify-validate");
$uri = implode("&",$post);
$ch=curl_init();
$this->error_out($uri);

curl_setopt($ch, CURLOPT_URL, $this->url_string);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $uri);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$this->paypal_response = curl_exec($ch);
$this->error_response = curl_error($ch);
curl_close($ch);

$this->error_out($this->paypal_response);

Posting Xml With CURL (post Header)
How can i create cURL post with these headers?

POST /xml.dll HTTP/1.0
UserAgent: IE6
Content-Type: text/html
Content-length: #counter goes here

what CURLOPT_'s i should use for posting?

How To Attach POST Data To CURL
I'm trying to use CURL to submit XML requests to web service API's.  I've got everything working except that I can't figure out how to actually attach my own custom XML string request to the POST.  As such, I'm getting XML responses that simply say 'Invalid Request'. Here's what my CURL function currently looks like: Code:

Using CUrl To POST To Listening IP/port
i need to handle CSV requests/responses for two FedEx products

FedEx Web Integrated Solutions - requests are posted to a remote FedEx hostFedEx Ship Manager Server - requests are posted to a local listening IP/port
i have successfully posted to WIS using the cUrl method as shown:

$ch = curl_init();
curl_setopt($ch, CURLOPT_PORT, $port);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, $server);
$reply = curl_exec($ch);
curl_close($ch);
echo $reply;

i used the following as my vars. as you can see, i send the request to a URL:

$server = "https://gatewaybeta.fedex.com/GatewayDC";
$port = "443";
$data = "csv,'data',goes,'here'";

finally, this is what i'm trying to accomplish. i would like to post a CSV transaction to a local IP/port that is running the FedEx Ship Manager like this:

$server = "127.0.0.1";
$port = "2000";
$data = "csv,'data',goes,'here'";

when i use the vars above, the script times out. i have several programs that access FSMS with Java socket classes, so i know that the port is open. all of the software is hosted on the same PC, so there aren't any network issues to worry about...

i would like to know if this is the proper way to submit data to a listening port via PHP. i'm not sure if i should even be using cUrl; according to the PHP manual, cUrl accepts HTTP, HTTPS, FTP, GOPHER, TELNET, DICT, FILE, and LDAP protocols. FSMS is built on Java, and there isn't very much documentation on the software (only 900 or so customers use it).

Secure Post With PHP And Curl (to Paypal IPN)
Got a problem that I have been working on for a while now which involves implementing the Paypal IPN. I am using PHP 4 to automatically post back to Paypal and I am using curl package.

I am doing a Custom request and would like to know if anyone has successfully posted data back to paypal with curl and got something other than INVALID back. I am always getting INVALID!!

I am doign EVRYTHING they tell me to.. ie ordering the parameters and adding the cmd=_notify-validate

I guess I have 2 questions:

1. Am I using curl properly with this paypal interface or is there something I am not setting.

2. Has anyone a working version with HTTPS/curl/paypal. I am using the
https://www.eliteweaver.co.uk/testing/ipntest.php to test this.

The code is as follows:

// put all POST variables received from Paypal back into a URL $post = array();

foreach ($this->paypal_post_vars as $field => $value) {
array_push($post,$field."=".rawurlencode(stripslashes($value)));
}
array_push($post,"cmd=_notify-validate");
$uri = implode("&",$post);
$ch=curl_init();
$this->error_out($uri);
curl_setopt($ch, CURLOPT_URL, $this->url_string);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $uri);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$this->paypal_response = curl_exec($ch);
$this->error_response = curl_error($ch);
curl_close($ch);
$this->error_out($this->paypal_response);

Unable To Login And Post To A Site Via Curl
There is a social bookmarking site here: http:// onlywire.com that I'm
trying to login and post to via curl.

It's using ajax and I haven't been able to figure out how to post to
it so far.

This is actually the first time I've ever seen a page that I can't
post to with curl.

CURL To Post Form Data To Another Site
Is there a way to use CURL to post form data to another site and make the URL change from the current php script to the url of the site that I curl to? Right now when i test this the URL remains as the name of mu script ... ie> www.mysite.com/curl.php instead of changing to the address I am doing the curl to. I tried setting this variable curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); but it only changes to the new sites URL when I click a link on that site.

Redirecting To Target Page Along With POST With CURL...
I want to send some POST data with cURL and then also redirect to the location where Im sending the POST data. Ive been running around like crazy and unable to find a way. This must be something very simple. Heres what I have thus far, except this doesnt redirect to my target page. Code:

Post Form With Field Containing "curl Curl"
I have a form that posts and 1 field is for a suburb, 1 of the suburbs in our area is "curl curl".

When ever this is entered we get an error message "You don't have permission to access".

Get Method Works But Not Post Method On PHP 5.0.4 Pages
I am unable to display PHP pages generated by a submission of a form
using a POST method. To illustrate this, I created a very simple form
called TestForm.php .

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Test Form</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr><td>Name</td><td><input type="text" name="name0"/></td></tr>
<tr><td>Age</td><td><input type="text" name="age0"/></td></tr>
</table>
<input type="submit" name="SubmitMe" value="Submitted" />
</form>
</body>
</html>

I first set the method for the form to GET and the page loaded again
after the submit.
When I changed the method back to POST, I received a Page Not Found
error page.
I created another page testform3.php to display the Form Values after
submit. I changed the action on the form to testform3.php.

Post And Redirect With Post Data
The solution we have though up is the following:

1. The user fills in data in a form and hits submit
- This submits (POST) to another page (redirect.php)
2. redirect.php adds more POST data to POST and then submits all this POST data to another page (offsite [payment portal])

The reason why we have to do this is for someone who knows our to read html source code, could easily find the sucessful page which will then do the processing we need to do on our side. Which means freebeis.

PHP Post, Then HTML Post?
Using PHP, I want to POST or GET some variables to a second php page.
This, I already know how to do.

However, on the second php page, I want to use a simple, standard HTML
form using the standard form-submitting method such as:

<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

whereupon both sets of variables --- the earlier variables that were
POSTed or GETted to the second page, along with the standard form
variables derived within the second page --- will be POSTed to the
above URL.

In the second page, might I actually translate the received variables
into actual HTML code? For instance, if my first page POSTed the
variable xyz to the second page, then might the following code on the
second page receive that variable and then include it when the second
page's "Submit" button is pressed?

<? $xyz=$_POST['xyz']; ?>
<INPUT TYPE="HIDDEN" NAME="xyz" value="<?=$_POST['xyz']?>" >

Or how, otherwise, might this be done?

Php/curl Works From Commandline, Not Browser?
While trying to learn the ins and outs of the php CURL library, I
decided to write a php script that posts a form on the Chicago Board
of Options (CBOE) web site, which returns an ASCII text file. CBOE
appears to keep your form query data in cookies, so this seemed like
a good use of curl.

Well, my script works just fine when run from the commandline.

When accessed from my browser, it returns an empty string where the
data should be. I have no idea why. Here is my script. Below it I
will add further comments.

========== begin script optionchain.php ==========
<?php
// cookie and error log path - SET THIS BEFORE TESTING
define(TMPFILEPATH, "/mf/home/unicorn/shell/tmp");

/*
* This script gets option chain data in a comma-delimited text file
* from the Chicago Board of Options web site www.cboe.com.
*
* Example for Microsoft (MSFT) stock options:
*
* URL syntax: http://example.com/optionchain.php?ticker=MSFT
*
* Commandline: % php optionchain.php MSFT
*/

$tickersymbol = isset($_GET['ticker']) ? $_GET['ticker']
: $_SERVER['argv'][1]; // get argument from commandline if no $_GET

$ch = curl_init(); // initialize curl

curl_setopt($ch, CURLOPT_VERBOSE, true); // verbose errors
$er = fopen(TMPFILEPATH.'/curl_err.txt', 'w'); // error log file
curl_setopt($ch, CURLOPT_STDERR, $er); // log the errors

curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_COOKIEJAR, TMPFILEPATH.'/cboe_cookie.txt');
curl_setopt($ch, CURLOPT_REFERER,
'http://www.cboe.com/delayedQuote/QuoteTableDownload.aspx');
curl_setopt($ch, CURLOPT_URL,
'http://www.cboe.com/delayedQuote/QuoteTableDownload.aspx');
curl_setopt($ch, CURLOPT_USERAGENT,
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)');

// "log in" to web site by accessing first page (sets cookie)
$discard = curl_exec($ch);

// now post the form. The result will come after setting more
// cookies and receiving a redirect to a different URL,
// http://www.cboe.com/delayedQuote/QuoteData.dat
// which returns data using the query data contained in a cookie.
// AFTER that we get redirected back to the original page,
// so limit redirects to 1

curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLOPT_POST, true); // enable HTTP POST
curl_setopt($ch, CURLOPT_POSTFIELDS,
'__EVENTTARGET='
.'&__EVENTARGUMENT='
.'&__VIEWSTATE='.urlencode('dDwtODQ5MjIyNjc7Oz5rmegY+ 4O27l7uWcpGd4iU+1RpAA==')
.'&ucHeader:ucCBOEHeaderLinks:ucCBOEHeaderSearch:sear chtext='
.'&ucHeader:ucCBOEHeaderLinks:ucCBOEHeaderSearch:Butt on1=Search'
.'&ucQuoteTableDownloadCtl:txtTicker='.$tickersymbol
.'&ucQuoteTableDownloadCtl:cmdSubmit=Download');

// Get data (RETURNS NULL FROM BROWSER, WORKS FROM COMMANDLINE ??)
$content = curl_exec($ch);

// Close resources
curl_close ($ch);
fclose($er);

// display result
print "<pre>Data:
{$content}
End</pre>
";
?>

PHP CLI Command Line On Win XP Pro Calling External Page With CURL
I wanted to avoid using VBSCRIPT to process a local script running on a win xp pro box. Being that I know php pretty well, I thought I might try it to solve the problem of not knowing vbscript.

I have it running fine on this machine. even have it so I can just type in the php script name instead of c:/php5/php.exe before the script. Cool stuff.

I need to call a php script on another server when this runs and receive a response. (preferrably using POST). I had a test working with vbscript using MS's XMLHTTP.

Not knowing what else to use. I got a quick test working with cURL but it doesnt seem to like the curl_setopt settings. without them, it calls the page (As GET) and receives a response.

So my question is. is there a better method than CURL to receive a response from a script running on the command line? and how can I get it to use POST if I cant use curl_setopt.

How To POST Using PHP ?
I am fairly new to PHP, I am not sure if what I want to do can be done. I have done some research but cannot find the asnwer.
Here is the problem. I have a Perl script that is called from and HTML form, with some hidden inputs, that uses POST method. The user has to enter some text input into the form and click 'Submit" button.

What I want to do is have my PHP script call the Perl script and pass similar information but obtained from a mySQL database, rather than the user form. How can I have my PHP simulate POST method?

Using $ GET And $ POST From Same URL
I am finishing off a new payment gateway script for the Shop-script Pro shopping cart and have run into a problem reading $_POST variables being sent back from the payment processor.

I supply the payment processor (paymate) with a return URL which has some variables in the URL string (?status=success&processor=paymate).

The payment processor constructs a confirmation page with a form which uses my return URL as a form action and a set of hidden fields which details of the transaction itself.

When I try to read the POST variables, they are not there. I am trying to figure out why that might be.

One possibility is that the URL I provide has GET variables in it, so maybe the PHP receiving page recognises this and will not try to read POST variables, even though I ask it to?

Another possibility is that Shop-script does not call the actual PHP script with the $_POST array reader as the return URL, but instead uses "[domain.com]?blah" (which calls index.php and it then calls the actual PHP receiving page (adding the header/footer/etc added in the process), therefore losing the POST data?

Is one of these more likely than the other? Any thoughts on how I might get around it without rewriting Shop-script completely?

Post And Get
I recently re-installed windows and with that apache, mysql and php. I've downloaded the new php version and now I have this problem. In my script I use post and get methods and now they aren't working anymore.

I've tried several things but when I use a form with post or get or and hyperlink (e.g. index.php?name=1) the page I go to doesn't recieve the values for some reason. I've tried a print() at the 1st line of the script so I know I don't have some code messing up, but they're empty.

Post To Self?
if test.php is this file:

<?php
$lang = $_POST["lang"];
print $lang;
?>

<form method=post action=test.php>
<input type=image src=engFlag.jpg name="lang" value=en>
<input type=image src=fraFlag.jpg name="lang" value=fr>
</form>

Post/get
Is there a way to sent data using hyperlink (GET routine) and retrieve it in $_POST array?? something like...

echo '<a href="boss.php?foo=bar" method="POST">link text</a>'
doesn't work (I retrieve data in $_GET) Is there another way?

POST Var
I'm trying to retrieve a file location, and then insert it into mysql as a longblob - but that is beside the point. I have a simple HTML form with <input type="file"... /> which should store the path selected, and that path should then be sent to a post var on 'submit'.

My problem is, the path is not showing up! It shows up in the HTML form, but when I submit the form, nothing is in the POST array representing it. Other form elements pass, but not the type="file". Is this some type of PHP issue with the way it handles HTML Forms? Code:

PHP Pre 4.2 VS. PHP Post 4.2
My local PHP install (for development/learning) is 4.3, but my hosting
service uses 4.0.6. Without turning on registered globals, is there a
common way these two versions can handle form data? 4.0.6 doesn't have
import_request_variable(), $_POST, or $_REQUEST, and 4.3 chokes on
$HTTP_POST_VARS[].

GET And POST
I just started learning PHP and got really confused by how PHP
receives varables from HTML form. I'm using PHP 4.3.9 downloaded from
php.net. In my html file I use POST to send variable 'userfile':

Getting POST From A URL?
I have a user system where I'd like players to be able to view each others' profiles. So basically what I'm hoping for is something like...

The URL, is viewprofile.php?id=xxxxxx

Where xxxxxx is, would be that player's ID number. But what I'm wondering is how exactly if I generated that, the script would figure out what the ID was referring to. This'd also make searching for the ID easier cuz I have a cool way of doing that.

Md5 And Post
I have a signup form that encrypts the password into md5 format, which then stores it in to the database.

I then have a login section that translates the password into md5 to check against the stored version. However the one that is entered and posted via a password field, results in a different md5 hash, is this due to the nature of the password field or post, if so what is the best way to store an encrypted password and then compare it?

PHP POST
I'm doing a page (only a demo) where there are articles. I've decided to practice and make a backstage admin page where I can add, modify or delete articles, and It works fine. Ah, I forgot to tell, I'm using a MySQL database to store the articles.

And the problem: I made my admin page, where I have a form which has all the articles, and have a checkbox assigned to each and every one of them. I'm using the POST method to go to a new page where I can edit the article. So, the problem is, I want the main admin page to be able to send more article IDs with POST (if more than one checkbox is checked) and the editorial page could edit multiple articles at the same time. I thought of arrays, and stuff, but I cannot make it work!

POST Not Working...
hello. im running php/mysql/apache on linux, os x and freebsd. on os x, everything works fine, but on linux and freebsd the default install of 4.2.3 does not accept POST....i dont know how to explain but when i submit a form, the data wont be changed to variables. i checked the ./configure --help file but there was no option...i just assumed it was built in...anyways thanks for any help.

Can You Post A Value In The Header?
I used to pass values through the header, but I have reinstall PHP I can't seen to get the value to pass.

Foreach Post
I'm not asking for help, im posting help.
if anyone wants to use foreach to return post vars, here's the code:

<? if($_POST['Submit']) {
echo "yay";
foreach( $_POST as $post ) {
echo $post." = ".$_POST[$post];
}
} ?>

POST Security
I've read the FAQ allready on security and saw i'd had to start a new thread about security and it's about .. yes security and forms.

I have a form and when I post the input from the users I want to check several things to be sure that it definitely came from my form, so not from somewhere else. I'm coding with register_globals=off so that's a good start. Now I want to be sure that it is really my form. (Maybe I'll sound a bit paranoic)
what would be more secure ?

1) checking on $_SERVER['http_referer'] ? -> easily spoofed or not and what about virtual hosts on one machine ?
2) creating session-id ? -> /tmp folder ? a hacker can always get into the machine maybe ?
3) a combination of both ?
4) something else ?

Security About POST!
I need to check and make sure users don't "hack" my post values. but im not really sure if i need to check these post values..

The values are coming from a registration form, and are the following... I will obviously check the database for existing users, or exisiting email addresses, but other then that, this code can't really be used to hack me, can it?? PHP Code:

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 ?

Post Method
I have an HTML form in which a user enters his/her name and once clicked submitted it should run the process form and show the name user entered. The problem is that the variable "username" is not been passed to my processvariable.php through html headers.
Code:

Question Regarding GET And POST
First off, I'm a newbie to PHP and server side scripting.

I'm curious if there are any specific guidelines as to when one should use "GET"
or "POST" in forms processing. I've had issues moreso with post than get but
have been able to resolve them relatively quickly.

Array Post
I have a form with this in:

<input type=checkbox name=test[] value=test1>
<input type=checkbox name=test[] value=test2>

Now I want to post this.
I have to check if something is clicked .I tried

if (!isset($_POST['test']))
echo 'no vars clicked'
else{
for ($i=0;$i<count($_POST['test']);$i++){
echo $_POST['test'][$i]."<br>";}}

anyway, it' doesn't work,if anyone can give me a tip no checking if there are vars in the array or not, would be great.

Using Post From Href
I have a large query result display php file that expects the query information to come in via $_POST and now I want to an another window that jumps to that same php file from an href with some predetermined query elements. Is there a way to have the href post the variables to the php file?

Doing An Http Post
For the benefit of others, I want to show how to do
an HTTP POST request using fsockopen(). I banged my
head against a wall for two days trying to figure
this out. I even went to http://php.net/ to find
out how to do this, but it didn't help because
my mind automagically converted the "Content-Length"
header into "Length."

I even went to find out
the specific protocol for HTTP POSTs, but I didn't
find it there. RFC 2616 (HTTP) does not give the
exact format for POST requests.

Question: Where is the format for POST requests defined?

---------------- send_post.php ---------------
<?php
// file: send_post.php
error_reporting(E_ALL & ~E_NOTICE);
$eol = "
";
$errno = 0;
$errstr = ''
$data = 'username=george&password=i81bpz'
$fid = fsockopen('localhost', 8080, &$errno, &$errstr, 30);
if ($fid) {
fputs ($fid, "POST /post/show_post.php HTTP/1.1$eol");
fputs ($fid, "HOST: localhost$eol");
fputs ($fid, "Connection: close$eol");
fputs ($fid, "Content-Type: application/x-www-form-urlencoded$eol");

// Use 'Content-Length' NOT 'Length' !
fputs ($fid, 'Content-Length: ' . strlen($data) . $eol);
fputs ($fid, $eol);
fputs ($fid, $data);
fputs ($fid, $eol);
fpassthru($fid);
}

?>
------------- show_post.php -----------------
<?php
// file: show_post.php
error_reporting(E_ALL & ~E_NOTICE);

echo "<pre>";
echo "------------ POST VARIABLES ----------";
print_r($HTTP_POST_VARS);
echo "------------ SERVER VARIABLES ----------";
print_r($HTTP_SERVER_VARS);
echo "</pre>";
?>

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 Medhod?
<form method="POST" action="OptionsModifier.html">
<input type="hidden" name="login" value="<?php print $_POST['login']?>">
<input type="hidden" name="password" value="<?php print $_POST['password']?>">
<input type="submit" value="DBase Interface">
</form>

when this page called the page named "OptionsModifier", it did not show me the page and the wrong information appeared below:

Method Not Allowed
The requested method POST is not allowed for the URL /testerLD/OptionsModifier.html.

PHP Post/Get Problem
I have been working on a simple form to collect user data. The form is
written in ASP. The target action is a PHP script on a completely different
system. The problem I have been experiencing is when I use the GET method
on the ASP form, my PHP page displays the data as collected. When I use the
POST method (preferred), very same PHP page does not display the collected
information. I have searched for anything that may give me a clue on
php.net but found nothing.

POST And GET Methods In Php 4.3.1
I am using PHP 4.3.1 on Mandrake 8.2. It appears that POST,GET methods are not working.

$post And $get Problem
Can i use $_post and $_get if i don´t it using a form.?

I have 3 php pages. in first page i want send a var with $post, I use
Request or get in second page and i send with $post to third page, but these
isn´t correct. I use Request or Get in third page but it don´t get anything.

PHP Will Not Post Vars.
When every I submit my form information it just puts the <?php echo
$PHP_SELF?> as part of the URL.

---------------------------------------------------------------
<html>
<body>

<?php
if ($submit){
//connect to database
//$host = "host";
//$user = "user";
//$pass = "**";
//$database = "driveaf";

$db = mysql_connect("host", "genuser", "pasword");
mysql_select_db("driveaf", $db);
//Connected to data base
//write data to db
$sql = "INSERT INTO users (empID, firstname, lastname, email,
password, reg_date, website) VALUES ('$empID', '$firstname',
'$lastname', '$email', PASSWORD('$password'), '$reg_date',
'$website')";
$result = mysql_query($sql);
echo "Thanks";
}else{
//

?>

<form method="post" action="<?php echo $PHP_SELF?>">
<p>Employee ID:
<input name="empID" type="text" id="empID">
</p>
<p>First Name:
<input name="firstname" type="text" id="firstname">
</p>
<p>Last Name:
<input name="lastname" type="text" id="lastname">
</p>
<p>email address:
<input name="email" type="text" id="email">
</p>
<p>password:
<input name="password" type="text" id="password">
</p>
<p>
<input name="submit" type="Submit" value="Submit">
</p>
</form>

</body>
</html>
-----------------------------------------------------------------------

Getting Form Name From Post
how do i get the name of a form thats just been submitted i.e. here how do i get "new_form"... Code:


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