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




How Do I Send A Http POST Without Using A Form?


I looked at using curl library, but it's not available on the host where I'm building my application. I need to be able to send a POST to a payment gateway and receive their response back.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Send XML HTTP POST Request And To Manipulate The Response.
I looking for a way to either create an XML document and have it read by php OR create within a php file an XML document and send the request via HTTP POST, but also to recieve the request and be able to manipulate the data, at which I can access any XML Tag.

Someone told me that the XML Parser function can do this. If this is correct, it also requires Expat to be installed and complied. Well the thing is I tried that and I got a whold bunch of bareword errors. I'm running FreeBSD/Apache/unix system

PHP Command-line Version Of Http Form Post
heres my problem.

I can consume a soap server in php within a browser by 'post'ing a
form variable that contains XML - no problem. However, if I want to
use the php command line to send the same data in the same way (as the
soap server sees it), what command-line grammar do i use?

Its trickey I know so ask for more information if you're not sure.

Send A Http Request
For my script to function correctly I have to validate a variable - I need to send a http request

I have the url I need to send the request to e.g http://domain.com/validate.asp?t=****&u=*****

Now I have the variables $t & $u - I need to send this as a http request and log the response I get back, it will be either: -

<response success="false">
</response>

or

<response success="true">
</response>

I have never used a http request before - an example would be very useful

Send Variables Through The HTTP?
Does anyone know how to send variables through the HTTP? I hope I'm asking the right question.

What Is The Raw Http Header To Send A Cookie
I am using fsockopen to communicate with an internal web server. It uses a cooke for authenticaion.

When I make the first request I get the cooke but don't know how to send it back... in other words how does the browser do it.

BTW, please don't suggest setcookie(), that has nothing to do with my problem.

Send Mail To Outlook From Http://localhost
Does anyone know how to set up a script to send mails from http://localhost to your local mail client (Outlook, to be exact).

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>";
?>

Sending HTTP Post
I'm writing a PHP script to wrap a CGI script that uses HTTP POST get its user input. If the CGI used GET, it would be easy, just do a PHP Code:

HTTP Headers With POST?
How do I display all of the POST headers?

What I want to see is all information related to a POSTed file and it's
attributes, sort of like this:

POST /file.php?var=value HTTP/1.0
Host: www.domain.com:80
Connection: Keep-Alive
Content-Type: multipart/form-data; boundary=xxxxx
Content-Description: form-data-1
Content-Disposition: inline; filename=file.txt
Content Length:1221......

Http Post Vars
I have a form with several check boxes in it..like 20. Now I need to generate a posting form for each check box marked on the form (if its checked by the user).

I could make 20 if statements, one for each check box, but is there a way to determine the number of variables passed, or checked in this case? Or are they all "passed" when the user submits the form. If there is a way to determine the number of variables passed via HTTP_POST_VARS, then I am assuming I can usea a loop to get their values from that array.

Http POST Data
and I've been looking all day on the web for
an answer to this question.

I'm trying to send some binary data, a relatively large amount (~128K), to a
PHP script from a wireless device that has TCP/IP sockets. So I'm sending
all of my data manually (ie ,"POST http://www.blah.com/process.php
HTTP/1.0
").

I am able to send regular form data such as
"tireqty=3&oilqty=4&sparkqty=1&address=4204MainStreet

";
To do this I have a header for the content type like so: "Content-Type:
application/x-www-form-urlencoded
";"

I have even encoded my data in base64 so that it is ready to send as ASCII.
This data is broken into chunks where after each 76 characters there is a

line break. I read that I needed to do that.

But HOW do I send it? If I send it as form data, with variables, then it
only receives the data up until the first line break. I tried changing the
content type to "Content-Type: application/octet-stream
", thinking that I
could just send the data without form variables, but then how do you access
that from PHP? For example I tried sending the string "data=XXXYYY" where
XXXYYY is my base64 encoded data, but it didn't work.

I can't seem to find any good documentation about this. Which Content-Type
shouldI be using? Can I use octet-streams and still have the data connected
to php variables? It's very confusing.

Submit POST Via HTTP(S)?
I'd like to submit a post via http(s) from my php page with a simple script. SSL would be optional. Suggestions/solutions? I didn't see --with-curl on my hosts info.php page so I guess it's not enabled.

Responding To HTTP Post
I am trying to figure out how to respond to an HTTP post in php script.

HTTP POST Problem
I am using PHP version 4.2 in RHEL4 system.

I am sending multipart binary data using libcurl from client
application and a php script at the server side recieves it. But
unfortunately the data received through $_POST variable is truncated at
the first instance of NULL character.
-> I cannot use base64 encoding as this is performance intensive and
client application is lightweight. We cannot afford this.
-> there seem to be no way access raw http data since client is
sending multipart data.

Is there any way I can be able to access http raw data or correct
binary data..?

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.

Using HTTP POST To Transmit XML Data /w PHP
Hello,

I am attempting to interface with UPS's shipping API's via PHP. The API expects to receive an XML dococument via HTTP POST or TCP/IP sockets. The POST request responds with the the desired info in XML form. So, lets say I have a package it is going from x to y, it ways w lbs. using UPS Ground-> This returns the shipping cost for that item. Now, I am fairly certain that this can be done using curl, but I am wondering if anyone can think of any other means of accomplishing this, perhaps with sockets or ...???

Passwords With GET/ POST HTTP/HTTPS
I know that if I send data using a secure POST method that the
data is encrypted but what happens if I use a GET method to a secure server.

Examples -

https://username:password@domain.com:2082/pages.php?page=2#index
or
https://username:password@domain.com/pages.php?page=2

How To Asynchrously POST A HTTP Request?
I need to POST a HTTP request from within a PHP app, to inform another
app regarding certain changes.

Since I don't need to get an answer back, I'd like to fire-and-forget
the POST request asynchronously.

An option might be to create a new PHP process, forward my data to the
new instance and continue execution in the main one.

FSOCKOPEN - Http POST Request
I have made a php function to send a POST request to a cgi program. It works fine when the length of the parameters is short. But when the parameters goes REAL long(say 3000 chars), the web server return an error message:

(apache error.log)
[Mon Apr 01 15:20:13 2002] [error] [client 127.0.0.1] Premature end of script headers: c:/somepath/mycgi.exe here is my code:

Sending Http Post Requests
I'm trying to send an http post request and see if the server got it
correctly. I'm sending the http post request with this script:

<?
$address = 'domain.tld'
$port = 80;
$proxy = fsockopen("tcp://$address", (int) $port, $errno, $errstr, 1);
$extra = "extra=blah&this=test";
fputs($proxy,"POST /test.php HTTP/1.0");
fputs($proxy,"Host: $address");
fputs($proxy,"Content-Length: ".strlen($extra)."");
fputs($proxy,"$extra");
while (!feof($proxy))
print fgets($proxy);
fclose($proxy);
?>

test.php's contents are as follows:

<?
print_r($_POST);
?>

this is what i want to see:

Array
(
[extra] => blah
[this] => test
)

this is what i am seeing:
Array
(
)

HTTP POST Firewall Work Around? - PayPal IPN
I'm trying to set-up a PayPal Instant Payment Notification backend to a
site. The problem is that I cannot post back to PayPal using
"fsockopen()" since my service provider (1and1.co.uk) blocks outgoing
HTTP connections because this "binds a port".

Does anyone know any workaround at all?
Have other people using IPN just used fsockopen?
is cURL an option? (I assume not but I have no experience whatsoever
with it).
Someone else mentioned IFRAMES once?

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.

Fsockopen() Sending HTTP POST Header
I recently learned how to use fsockopen() to send a POST HTTP header and read the response, and I have done this successfully to get a rate zone table from the UPS Web site, having sent the origin ZIP code as one of the variables.

I am now working on a completely separate project and trying to send a POST header to a test page on the server on which I am developing, and I have run into a snag. The fsockopen() function is connecting to the page specified in the POST header, but it doesn't appear to be receiving any of the variables. Code:

Send Post Data In Attachment?
Is it possible, using a post form, to send the data via an emailed attachment? Basically, I was wondering if I could put the data into a .html attachment which would be printer friendly and editable.

Server Can Not Send Data Via Get/Post???
I have a form that when processed produces a url of
/search.php?type=1&location=Special+Events
and when i say

<?php
foreach ($_GET as $key => $value){
echo $key." :".$value;
}
?>

nothing is showing up.  Nor Can i access anything get anyway.  I've tried using post on it too, nothing I'm on 4.7 so I know the $_GET nomenclature isn't an issue, but I've stumped.

How Does One Send A Large String As A POST To Another Web Page?
If I've a big string and I want to send it to another web page as a GET
request, I just use file(). I've done this often.

But what command do I use when I want to send the same string as a POST
request?

How To Send A Special Request With SOAP Or A Simple POST Or Else?
I need a server to send an other some information, like to create an
other database.

I would like to send something like that :
<?xml ?>
<insert table="the_table">
<row>
<row_id>4</row_id>
<name>Malkovitch</name>
</row>
<row>
<row_id>5</row_id>
<name>Smith</name>
</row>
</insert>

How Redirect A User To Another Page And Send Some Variable With The Post Method?
I make a user registration. It contains two/more page. First page is for official purpose. User ID, password and some other official information is in first page and user basic information is in second page. If user enter an user id that already exist in database then a message show the same page to change his user id otherwise page is redirect to second page and send user id, and other variable that was in first page.   My Code:

Send A Automatic Reply Email And Post A Subject Line
Currentley my PHP code doesnt post a subject line for the email it creates. I want a set subject e.g 'web site contact form01' to be posted with the email my code generates. Is thispossible, if so how?

Another thing I wish to do is send a automatic confirmation reply email to the sender. Is this possible with my current code? Code:

HTTP Form Values
On one page I have checkboxes being selected and then submited via a form post. The problem is the values and names of the checkboxes change each time the script is ran. So I have to know what they are to call them on the next page. Is there any way to retrieve all the HTTP passed variables in php that where passed without knowing the variable name?

Processing Http Auth From Outside Form?
I'm trying to make it possible to login from a cpanel account from my main site login. I found some code that opens up the socket, but how would I then display or redirect to that page?

Just to reiterate what I'm trying to do, rather than having them type in: lonestarservers.com/cpanel/ and then have the http auth form popup, I want them to be able to type in their user and pass on the index.php page and have it process it for them without that http auth popup. Code:

Stripping Http:// Form A Url When Displaying To A Page...
Hi I'm trying to display URL's in my link exchange like google does.

Here is the function to display the Link, Description and URL:

Simulate Send Data With POST And Get Data From A Web Page (whith A Session)
I'd like to get text of a webpageB that I reach by putting
a login and a password in a webpageA.

I mean:
I'd like to get text of a WebPageB with a php script.
But before I can see WebPageB I have to autenticate myself
in a WebPageA writing my login and my password in a form,
the host recognise me and (by session) let me see the WebPageB.

The question is:
1)how to simulate send data (login an password) in form with a PHP script?
2)how to navigate in a Web usin the same session?

HTTP Header Response For Invalid Form Inputs?
Is it necessary or is there any standard to send HTTP header status
for form inputs ? Say, the user is entering invalid password in login
form and now all the applications I have seen are just displaying error
messages above the form (with HTTP status 200); is it necessary to send
401 status in this case?

Send Form To Email In Url
I need to know how I can have a form sent to an email that is in a URL.

For example:
If I have a site with a form that has
First Name:
Last Name:
Email:
Phone:

in it, and a person goes to www.test.com/?email@emailaddress.com (or
something like that)then I need the form results to go to that email
address in the URL.

If a different person has a person go to the same URL but uses a
different email address, then the results of the form need to go to
that email address.

I also want it to send it without opening up a seperate email program
(outlook, etc.)

No Form Datas Send?
It doesnt work to send data (simple text).

I tryed everything (..i know) in httpd.conf and in php.ini.

Mailing Form - Can't Get It To Send
I tried going through your sample code and that didn't work either. If a field isn't filled out properly the error message comes up as intended, and after I submit the form it redirects me to the correct website as intended. However, the email of the form information is never being sent back to me. Code:

Send Form Via Email
I have a form and it includes textfields, groups of check boxes and goups of radio buttons. I want the user to fill out the form ( I can handle the form validation stuff myself). I then want the user to hit "Send" and the form comes to me via email (i.e. no database usage). Code:

How To Send A Form As An Email ?
I bought two books on PHP and followed the author's instructions closely but I can never be successful in submitting a form.  The information on the form is supposed to be sent as a string through email once users click the "submit" button.  Based on the books, I have configured the php.ini file and so on but things never worked.  I'm too disappointed.  Any ideas or suggestions ?

Send From A File As If From A Form
I have this code to send values to a file. The values are entries received from a form, but cannot be sent directly from the form.

I need to send this data so it is received as if it were from the form, i.e., as in method=post form action. What needs to be added so that to the receiving file it looks identical to a form submission? Code:

Send PHP Values By Web Form Mail
Is that possible to send out the php values by web form?

for example:
<?php echo $x_price;?>

<?php
if ($x_departure!= NULL) {
$sqlwrk = "SELECT * FROM `departure`";
$sqlwrk .= " WHERE `departureID` = " . $x_departure;
$rswrk = mysql_query($sqlwrk);
if ($rswrk && $rowwrk = mysql_fetch_array($rswrk)) {
echo $rowwrk["departurePort"];
}
@mysql_free_result($rswrk);
}
?>

How To Send A Variable From A Form To Php In A Link ?
<form>
<input type=text name=action1>
<input type=submit>
<form>

<a href=testit.php?action=$action>click here</a>

i want a link to send a variable keyed in by the user to php when i click on the link
can i do that?

How To Send An Image In An Email Form
I would like a "recommend a friend" script which a visitor can send to multiple recipients (did find a free script to do this) but also be able to send an image with the email to the multiple recipients.  I did find a script that allowed me to send an image, but not allow me to have "multiple recipients".

Anyone know a script that would allow me the best of both worlds?

Send To Another Email Address With This Form?
How would i send this to another 2 email address of my choice in a blind cc? Code:

Form To Send File Via Email?
I'd like to have visitors to my site who come to get a file fill out a form (name, email, etc.) and have the file emailed to them. This way I can identify those who want the file.

Send Multiple Form Data To Mysql
Im trying to use a textarea form field to input oh say 1000 entries to the mysql database. Each new line in the form field constitutes and new data entry and each table field would be delimited with a , or a ¦.

I know I need to have php grab each line and throw it into and array for processing to the db, but like I said, Im too new to get the gist of where I need to head to.

Send Form To Multiple Recipients From Website
I have a form on my site for people to register with my company. I receive the form with the details via email which is fine. Is it possible to send an altered version of the form to the person who filled it out also i.e. a sort of automated confirmation email of their details. Can this be done from the same script which sends the original email?

Send My Form Data By Mail In Order
I have a form where users type all the information that we request and after that, they press a bottom and all that information is send it by email, but I would like to receive this information in order. Code:

Send Enquiry Form By Email And Store Details
I want to send following form by email.... Can i send it .... Further Can I send auto response (to the person who fills up the form)

and in case we need to store the information entered in database what changes I need to make vis-a-vis norm form on web site I am asking this because the form wil be sent via email and will be filled us online and not on my web site Code:


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