Re: How to get PHP to do a POST??
| From: | Christopher Ostmo | Date: | Thu, 28 Jun 2001 07:12:24 +0000 |
| Subject: | Re: How to get PHP to do a POST?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55453@lists.php.net to get a copy of this message | ||
Patrick Calkins pressed the little lettered thingies in this order...
> Hello all!
> Here is an interesting problem that I can not solve, maybe one of you
> know?? Here is what I'm trying to do. I sell a lot of items on eBay, and
> lots of people ask me for a quote on shipping. We ship via UPS and I go to
> their site a lot to lookup rates. I decided to make my own web page that
> links into UPS' with most of the fields already pre-set, and all I want to
> do is give the user back a total for shipping. I need to manipulate what
> comes back from UPS first, so I can add to the shipping price to cover
> materials, etc, then give the final numbers back to the end user. This is
> where I have a problem. I was able to have my page act as a user-agent, and
> do the submit itself, however on UPS's site, their submit button is not a
> button, but rather an image. Since a button is easy to know what values are
> getting set (ie name="Submit" value="getinfo"), I did not know what vars
> the image-submit was setting, since there was no 'value' variable, only a
> 'name' variable. I tried it on my own server and found that php assigns the
> values 'name_x' and 'name_y' giving us the x&y values of where the user
> clicked, but UPS does not use PHP, so I don't know what their software sets
> the submit values to hence it does not work correctly. Their form just
> thinks something went wrong and displays the beginning again. If I just
> include their submit button on my form, then all works fine, except for the
> fact that I can't intercept the data comming back from UPS so that I can
> adjust the prices. Any idea on how to do this???
>
You can (and should) sign up for a developer's account with UPS so
that you can get access to their online tools. With their documentation
about their online tools and a basic knowledge of PHP's sockets (i.e.
fsockopen()), you will be able to connect directly to the page on their
web site that processes shipping costs and have a PHP socket bring
the results back to your web browser. This elimnates the need to
simulate a button click. I have done this, but I am not yet at liberty to
release the code to the public domain.
It isn't difficult if you know how to use sockets.
Christopher Ostmo
a.k.a. tech@AppIdeas.com
AppIdeas.com
Meeting cutting edge dynamic
web site needs
For a good time,
http://www.AppIdeas.com/