Archive for: March, 2009

USPS Web Tools

Mar 27 2009 Published by under PHP

I was trying to add the USPS API into osCommerce. I received the following error when adding this shipping module:

RateV3 is not a valid API name for this protocol

This is because when you create an account for the Web Tools at USPS you only have access to their test server. The USPS test server can only use RateV2, so test using this code below, then request to be switched to use the production server. Then you can use RateV3 on the production server and the USPS module for osCommerce will work.

<?php

$request1 = <<< XMLREQUEST
<RateV2Request USERID="xxxxxxxxxxxxx">
<Package ID="0">
<Service>PRIORITY</Service>
<ZipOrigination>10022</ZipOrigination>
<ZipDestination>20008</ZipDestination>
<Pounds>10</Pounds>
<Ounces>5</Ounces>
<Container>Flat Rate Box</Container>
<Size>REGULAR</Size>
</Package>
</RateV2Request>
XMLREQUEST;


$request = "http://testing.shippingapis.com/ShippingAPITest.dll?API=RateV2&XML=" . rawurlencode($request1);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SLL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);


$response = curl_exec($ch);
curl_close($ch);

echo($response);

?>

2 responses so far

Use Python to Save an FTP Directory List to File

Mar 13 2009 Published by under Python

Written for Python 2.6

#!/usr/bin/python

import ftplib

ftp = ftplib.FTP("ftp.server.com")
ftp.login("username", "password")
ftp.cwd("path/path")

data = []

ftp.dir(data.append)

ftp.quit()

outputFile = open('dirList.txt','wb')

for line in data:
    outputFile.write(line + "\n")

outputFile.close()
Reblog this post [with Zemanta]

No responses yet

Chicken Fried Lyrics

Mar 01 2009 Published by under Music

Zac Brown Band

More CMT Shows   More CMT Videos

You know I like my chicken fried
A cold beer on a Friday night
A pair of jeans that fit just right
And the radio up

Well I was raised up beneath the shade of a Georgia pine
And that’s home you know
With sweet tea, pecan pie and homemade wine
Where the peaches grow
And my house it’s not much to talk about
But it’s filled with love that’s grown in southern ground

And a little bit of chicken fried
Cold beer on a Friday night
A pair of jeans that fit just right
And the radio up
Well I’ve seen sunrise
See the love in my woman’s eyes
Feel the touch of a precious child
And know a mother’s love

Its funny how it’s the little things in life that mean the most
Not where you live, what you drive or the price tag on your clothes
There’s no dollar sign on a piece of mind; this I’ve come to know
So if you agree have a drink with me
Raise your glasses for a toast
To a little bit of chicken fried

Cold beer on a Friday night
A pair of jeans that fit just right
And the radio up
Well I’ve seen sunrise
See the love in my woman’s eyes
Feel the touch of a precious child
And know a mother’s love

I thank God for my life
And for the stars and stripes
May freedom forever fly, let it ring.
Salute the ones who died
And the ones that give their lives so we don’t have to sacrifice
All the things we love
Like our chicken fried

Cold beer on a Friday night
A pair of jeans that fit just right
And the radio up
Well I’ve seen sunrise
See the love in my woman’s eyes
Feel the touch of a precious child
And know a mother’s love

Getsa little chicken fried
And cold beer on a Friday night
A pair of jeans that fit just right
And the radio up
Well I’ve seen sunrise
See the love in my woman’s eyes
Feel the touch of a precious child
And know a mother’s love

No responses yet