hello,
  I'm trying to use cURL to mimic a browser requesting data from UPS' web
site. Here's the
link (for getting a shipping rate)...
http://wwwapps.ups.com/servlet/QCCServlet

I try to fake sending all the post vars with cURL, however it doesn't work.
Here's my code...

// declare var vals here
$o_country="US";
$o_postal="78758";
$o_city="Austin";
$d_country="US";
$d_postal="10005";
$d_city="New York";
$weight="2";
$length="12";
$width="9";
$height="4";
$value="40";

// encode some that might have spaces and stuff
$o_city=rawurlencode($o_city);
$c=rawurlencode("02");
$url = "http://wwwapps.ups.com/servlet/QCCServlet";;
$post =
"currencycode=USD&iso_language=en&iso_country=us&origcountry=$o_country&orig
postal=$o_postal&origincity=$o_city&destcountry=$d_country&destpostal=$d_pos
tal&destcity=$d_city&residential=NO&packages=1&rate_chart=RTP&container=$c";
$post
.="&weight1=$weight&weight_std1=LBS&length_std1=IN&height1=$height&length1=$
length&length_std1=IN&value1=$value&ratesummarypackages_x=34&ratesummarypack
ages_x=10";

$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0)");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_REFERER, $url);
$results = curl_exec ($ch);
curl_close ($ch);


...yet all this does is return me to the first screen. I checked for hidden
inputs and stuff - i got them all. Anyone got any ideas?

-dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to