Jump to content

Getting an Integer from a URL


Guest benlogan

Recommended Posts

Guest benlogan

Hi,

I have a url, which works out postage accoring to destination, weight etc..

here is the url

$url = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$topcode&Country=$dest_country&Weight=$sweight&Service_Type=ECONOMY&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes";




entering this in your browser




http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=3793&Destination_Postcode=3867&Country=AU&Weight=5&Service_Type=STANDARD&Height=100&Width=100&Length=100&Quantity=1




will diplay




charge=3.6 days=2 err_msg=OK

.

I would like to integrate that into the flat rate part of cube cart. bu i dont know how to store the "charge" integer.

thanks.

Link to comment
Share on other sites

function getPostCharge($posturl)

{

	$all = file_get_contents($posturl);

	$bits = preg_match('/charge=(\\d*\\.?\\d*)/',$all,$out);

	return $out[1];

}



$postcharge = getPostCharge("http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=3793&Destination_Postcode=3867&Country=AU&Weight=5&Service_Type=STANDARD&Height=100&Width=100&Length=100&Quantity=1");

http://uk.php.net/preg_match

PS: 3.6 is a double or floating point number, rather than an integer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...