By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,365 Members | 3,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,365 IT Pros & Developers. It's quick & easy.

issue with Snoopy Class and Fedex

P: 1
Hi,

I will like to use Snoopy class to check the rate and the price to ship a box with Fedex.

I have begun with this code but I cannot do domething usefull with it yet.

Can someone can assist me?

thanks

Reg


<?PHP
include("../config_inc/Snoopy.class.php");

$snoopy = new Snoopy;

session_start();

$submit_url = "http://www.fedex.com/ratefinder/home?cc=ca&language=fr";

$temp_dir = "http://www.dealandship.com/public_html/";

if($snoopy->fetch($submit_url))
{
echo "response code: ".$snoopy->response_code."<br>\n";

while(list($key,$val) = each($snoopy->headers))
{
echo $key.": ".$val."<br>\n";

if ($key == 4)
{
//echo $key.": ".$val."<br>\n";
$thestring = $key.$val;
//echo "thestring=<<".$thestring.">><br>\n";
$start1 = strpos($thestring, "4Set-Cookie: WGRTSESSIONID=");
$valueID = substr($thestring, $start1+strlen("Set-Cookie: WGRTSESSIONID="));
//echo "valueID1=<<".$valueID.">><br>\n";
$end1 = strpos($valueID,'; path=/');
$valueID2 = substr($valueID, 0, $end1);
//echo "\nvalueID2=<<".$valueID2.">><br>\n";
}
}

echo "<p>\n";

echo "<PRE>".htmlspecialchars($snoopy->results)."</PRE>\n";

$snoopy->cookies["WGRTSESSIONID"] = $valueID2;
$_SESSION['orion'] = $snoopy->cookies["WGRTSESSIONID"];

$submit_url = "http://www.fedex.com/ratefinder/standalone?method=getQuickQuote";

$submit_vars["BuildTimeStamp"] = "01/29/2008 02:46 PM";
$submit_vars["transitTime"] = "false";
$submit_vars["locId"] = "express";
$submit_vars["originSelected"] = "N";
$submit_vars["destSelected"] = "N";
$submit_vars["zipField"] = "";
$submit_vars["currentPage"] = "rfsshipfromto";
$submit_vars["origCountry"] = "CA";
$submit_vars["origZip"] = "j7x1b3";
$submit_vars["destCountry"] = "CA";
$submit_vars["destZip"] = "g8b1b3";
$submit_vars["totalNumberOfPackages"] = "1";
$submit_vars["isPackageIdentical"] = "NO";
$submit_vars["totalPackageWeight"] = "66";
$submit_vars["weightUnit"] = "lbs";
$submit_vars["receivedAtCode"] = "1";
$submit_vars["shipDate"] = "01/29/2008";
$submit_vars["shipCalendarDate"] = "01/29/2008";

//$snoopy->cookies["WGRTSESSIONID"] = $valueID2;

if($snoopy->fetch($submit_url))
{
echo "response code: ".$snoopy->response_code."<br>\n";

while(list($key,$val) = each($snoopy->headers))
{
echo $key.": ".$val."<br>\n";
}

echo "<p>\n";

echo "<PRE>".htmlspecialchars($snoopy->results)."</PRE>\n";
}
}
?>
Jan 22 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.