Jump to content

Recommended Posts

Do you guys know how I can get php to return this JSON Object properly?

 

My current script fails.

 


<?php 

if (isset($_GET['page']) && $_GET['page'] == "featured")
{

?>
{	"equipments" : [
			{"id" : 1234567,
			"name" : "Articulating Boom Lift",
			"specUrl" : "/data/spec/equip1.pdf",
			"summary" : "Varying heights: 20' - 60' with emissions free operation, heights to 80' with diesel/dual fuel systems and 150' with diesel; Available in electric, gas, propane or diesel; Large work platforms with up to 500 lb. capacity; 4-wheel drive and rough terrain models available.",
			"description" : "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
			"quantity" : 1,
			"existInCart" : false,
			"cartTransactionId" : 6509299203
		}
	]
}
<?php 

}
if (isset($_GET['page']) && $_GET['page'] == "tropical")
{

?>
{	"equipments" : [
			{"id" : 55727,
			"name" : "Bucket Truck",
			"specUrl" : "/data/spec/equip1.pdf",
			"summary" : "Available two man platforms; Platform leveling system; Available height range 34' - 51'; Outrigger & backup warning alarms; Tool lines at boom; 12V emergency operating system",
			"description" : "Equipment availability may be limited and rental rates are subject to change without notice. Taxes and additional costs and or fees, such as refueling, Loss and Damage Waiver, and delivery are extra when applicable. All terms and conditions of the Hertz Equipment Rental contract will apply.",
			"quantity" : 1,
			"existInCart" : false,
			"cartTransactionId" : 6509299222
		}
	]
}
<?php

}

?>

Link to comment
https://forums.phpfreaks.com/topic/266875-need-php-to-return-my-json-object/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.