obobrar Posted November 11, 2011 Share Posted November 11, 2011 I am modifying someones existing coldfusion web app. I am adding php processing pages to do various tasks. Up to this point I have just been calling the php pages, and interacting with the web app by passing variables via the url. Current usage: public.cfm calls processing.php?id=69 Then processing will do what it has too, then ultimately: header("Location: $publichome?id=$id&importantstuff=$stuff"); exit(); And the webapp will pick up where it has too. But now one of my scripts has to send a JSON object back instead of simple variables. I don't know how to get this done. I tried doing a post with cURL but that wasn't working because I need the public facing coldfusion page to take over and curl returns to the php script (I know I can echo the body of the curl result but this keeps me on the php script domain which I dont want). Is there a way to do the above header location and send an object because thats what I need - the php script to stop and the coldfusion page to be served up with the object to work with. Do I have to create some sort of JSON service in php, that the coldfusion page will call an retrieve the result? If so how? Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/ Share on other sites More sharing options...
xyph Posted November 11, 2011 Share Posted November 11, 2011 This depends on what kind of input the CFM expects. Generally, a web application won't take raw data, and instead expects a URI or path to locate the data. Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/#findComment-1287414 Share on other sites More sharing options...
obobrar Posted November 11, 2011 Author Share Posted November 11, 2011 I can modify it to accept anything, or do anything I want. Suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/#findComment-1287418 Share on other sites More sharing options...
obobrar Posted November 11, 2011 Author Share Posted November 11, 2011 Would storing the JSON in a DB on the php side, then fishing it out in coldfusion be stupid? Considering the JSON could contain thousands of items..as writing this it seems like a terrible idea. Any other ideas would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/#findComment-1287420 Share on other sites More sharing options...
xyph Posted November 11, 2011 Share Posted November 11, 2011 Database is a great way to access large amounts of data. JSON is a form of simple flat file database. Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/#findComment-1287430 Share on other sites More sharing options...
obobrar Posted November 11, 2011 Author Share Posted November 11, 2011 Any recommendation on column type for the JSON data - considering I do not know the limit of the data and could be fairly large? Using MySQL. Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/#findComment-1287434 Share on other sites More sharing options...
xyph Posted November 11, 2011 Share Posted November 11, 2011 I would only use an RDMS if you were parsing the JSON data individually If you just want to store the raw JSON, use a temporary flat file. Quote Link to comment https://forums.phpfreaks.com/topic/250949-need-to-send-json-from-php-processing-to-public-page/#findComment-1287455 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.