anybody else know?
Fedex Rate Calculator
I'm attempting to use the ups web tools..
well,....I would but I'm legally bound not to do so. I sold the scripts to a company and they have them copyrighted.
www.supracart.com is the company
I still would, but I don't think I even have a copy any more. Sorry.
Search on google. There's some scripts out there. I know from when I was looking to write one myself.
I was wondering if you ever found the code or if you wrote it yet?
I have been working on it for 2 days and the two ways I have tried to get in will not work. Do you have any ideas?
I let it go for the time.
I think the best way to do it though would be to use XML and use the XML api that they provide. It confused me so I just stuck with UPS for the time
I might make one out of interest
let me know if you get it
yeah, you have to download the manual from there, then you can sign up for an account and download the fedex api XML thing, and then you're on your way to a long night
When I went to FEDEx to find a XML program, the only thing I could find was a tracking program. I called FedEx and (according to them) they don't have a XML program for rate checking. Where did you get it, and may I see some or all of it?
this is really a client side functionality.
use javascript for it. here's something i made to do rough interest calculations. you should be able to modify it for your purpose.
<html>
<head>
<title>intrest estimator</title>
</head>
<body>
<p><h1>This is rough-estimate earning calculator. It forgoes some things such as compounding interest. It also calculates only by full year.</h1>
<!-- this is a list of instructions on use -->
<p>
<nl>Instructions on use of Calculator
<li>write yearly deposit amount<sup><font size=-1>1</font></sup> in text field marked "Deposit Amt."
<li>write yearly intrest rate<sup><font size=-1>2</font></sup> in feild marked "Interest Rate"
<li>write number of years<sup><font size=-1>3</font></sup> you wish to leave it in the bank in field marked "Term"
<li>leave the "Final Amount" field as is.
<li>push the calculate button
</nl>
<!-- list of restrictions -->
<br>1: must be a positive integer greater than or equal to 1 with no more than two decimal places.
<br>2: must be between 0.00 and 20.00 inclusive. The default interest rate is 0%. this will be used if no interest rate is provided.
<br>3: this can be as low as 1 year.
<p>
<!-- form with a table nested in it to give clarity and alignment -->
<form name="intCalc">
<table cell border=1 cell padding=%1>
<tr>
<td>if one places $</td>
<td><input type=text name=deposit size=10 value="Deposit Amt.">
<td>per year
</tr><tr>
<td>at an intrest rate of
<td><input type=text name=intrest size=10 value="Interest Rate">
<td>% per year
</tr><tr>
<td>for a total of
<td><input type=text name=yrs size=10 value="Term">
<td>years
</tr><tr>
<td>one will have $
<td><input type=text name=amt size=10 value="Final Amount">
<td>at the time of withdrawl
</tr><tr>
<td>
<td align=center><input type=button value=calculate onClick=calculate()>
<td>
</tr>
</table>
</form>
<!-- script that checks the variables and does the calculation -->
<script language="JavaScript">
function calculate(){
/* first grab the three variables that will be used */
var dep=(document.intCalc.deposit.value *1);
var rate=(document.intCalc.intrest.value *1);
var length=(document.intCalc.yrs.value *1);
var total=0;
/* then check to make sure they are valid */
if (dep==null){ //check to make sure there's a deposit
alert("Please enter a deposit amount.")};
else if ((dep*100)<100){ // if so make sure it's not too low
alert("The yearly deposit is too low")};
else if (((dep*100)-Math.round(dep*100))>0){ // make sure there's no fractions of a penny
alert("You can't deposit fractions of a penny")};
// else if (b=="Interest Rate"){
alert("You forgot to negotiate an interest rate.")};
else if (((rate*100)<0)||((rate*100)>2000)){ // make sure it is valid
alert("The rate is invalid")};
// else if (c=="Term"){
alert("You forgot to set a Term.")};
else if (length==null){ // check for the number of years they want it held
alert("Please enter the number of years your money will be in the bank's possesion")};
else if (length<1){ // make sure it's at least a year
alert("This bank will not hold onto your money for less than a year.")};
else if ((length-Math.round(length))>0){ // and that it's not got some weird fraction
alert("That includes a fraction of a year please decide how many YEARS you would like it deposited for. We don't try to guess how you divided the year into decimal form.")};
/* if all that is valid, then calculate the value */
else {rate=(rate/100)+1; //make the 1.x% so that when multiplied by the total it will yeild the result
/* then calculate the amount... */
for(i=0; i<length; i++){
total=(total+dep)*rate;};
/* ... and return it to the user */
document.intCalc.amt.value=Math.round(100*total)/100; //this makes sure there are only 2 decimal places.
};}
</script>
</body>
</html>
the comments in the code explain what each section does. you should be able to modify it without much issue if you know simple javascript. i never really got into it and was able to whip that up in 15 minutes for a friend a long time ago (it might be compliant with a javascript revision one step back)
I dont' remember it's been so long. If you look at my original post it was last year.
It was under their api section for integrating.....
WAIT, NO. One of the guys from fedex contacted me to see if I was interesting in doing a script for them and they would provide me with the XML "gateway" and I would have to write the php part.
But I think they said it was somewhere under the api section that you could download it.
lol. it was like the 5th post when i responded
I have this much done but there is a problem with the head and the server gives me a RFC 2068 Hypertext Transfer Protocol Error # 10.5.1 500 Internal Server Error
Take a look and see if you can tell why I get this error.
define(ROOT_URL, "https://gatewaybeta.fedex.com");
// -----------------------------------------------------------------------------
function Authorize($request)
{
$fedex_url = ROOT_URL."/GatewayDC";
$ch = curl_init(); // initalize cURL STEP(1)
curl_setopt($ch, CURLOPT_URL, $fedex_url); // connect to fedex STEP(2.1)
$header[] = "";
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_HTTP_VERSION, 1.0);
$ContentLength = strlen($request); // the entire url length
$crqstring = "";
$crqstring .= "POST /GatewayDC HTTP/1.0\r\n";
$crqstring .= "Referer: My-co-dot-com\r\n";
$crqstring .= "Host: gatewaybeta.fedex.com\r\n";
$crqstring .= "Accept: image/gif, image/jpeg, image/pjpeg, text/plain, text/html, /\r\n";
$crqstring .= "Content-Type: image/gif\r\n";
//$crqstring .= "Content-Type: text/plain\r\n";
$crqstring .= "Content-length: ".$ContentLength." \r\n\r\n";
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$crqstring);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str); // name=value pairs from above STEP(2.3)
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return results STEP(2.5)
$result = curl_exec ($ch); // connect and grab the results STEP(3-EXECUTE)
curl_close ($ch); // STEP(4-CLOSE)
echo "<br>$crqstring<br>";
echo "<br>$request<br>";
echo "<b>$result</b><br>";
if ($request == TRUE)
echo "executed = true<br>";
Let me know if you can see what is wrong. I know it is in the header somewher, I just don't know where.
it looks like the content type you're sending is actual text/html.
comment out the picture and change plain to html. you can't tell a browser to expect one type and five it another. they don't deal with that well. i know they can deal with switching between types of text and types of pictures (well somce can) , but i've yet to see them deal with a mixed bag of text/picture.
remember, when a web page loads, all it has is text. the images are actually extra calls that have their own headers