Send JSON Data to Browser but HIDE contents - php

I'm not sure if I'm getting this right, but I'll try to describe what I do. I've got a file with JSON data in it, which is needed for a synology package server, so if I add the url to the package server of the synology nas it accepts it as Package Server and reads the packages. This all depends on the JSON file and I need to set DirectoyIndex of my Apache to this JSON file to make it work. The Downside now is, everyone accessing this url with a browser can directly look into this JSON file.
Can I somehow wrap or hide this json data but still have it used by the NAS Package Server. IE using a index.php or index.html showing some kind of webpage but having the json data transferred too, when accessing the page?

Related

I can't get data from JSON to flutter if first, I can't browse the PHP file

I get data from the database using the php and encode to JSON. It works.
Then I use these codes inside flutter. It also works.
But next day my project doesn't work!
If first, I browse relating to PHP file in the browser(Chrome). Then Flutter project works.
But If I can't browse the PHP file, Flutter project doesn't work.
So this PHP file is a project file that users can't know to load first it. :)
I think subject is about the "Verifying that you are not a robot..."
When I load the PHP file first, I see this verification attention. I can verifying the php file. And everything is ok.
But Flutter can't pass this verifying state when calling the PHP file.
I guess problem is about the verifying of PHP file.
How can I fix this problem?

show MySQL data into web without server

I want to develop a web page to show a google maps map and put markers with the information of a MySQL database.
The objective is to make a file "map.¿php?¿.html?¿.js?" which do that.
The file must be used in several environments, where they have local access to the database.
I´ve been searching information and I´ve seen that i need to install some web server(like XAMPP), but i can´t install in every computers or in every servers(and it isn´t safe for production environments).
Can I create a local web page that shows ÇMySQL data withouth installing anything else?(I can install a connector to MySQL if it´s needed.
You can put a single file on your own webserver wich connects with the MySQL database. After that write some JavaScript / jQuery in your HTML to do an AJAX call to the file created before.
None of your users will need an webserver, all data will be requested from your server.
You can do an HTML/Javascript file for display the google map without server (but you need internet connection) and php file on your server for get the data.
In your JS, you can call a distant server who contain the MySQL database and your markers.
Example, with jQuery :
$.ajax({
url : 'http://your_domain.com/your_script_php.php',
async : false,
success : function(response){
// Contain the response of the server :
console.log(response);
}
});

Android + PHP: How to protect my server side image file location when passing to the android through JSON

Normally, we need to pass the full path of the image (e.g. htt://xxxx/xxx.jpg), through JSON or XML, to android device. Then loading it to imageView. Yet, I wish that only authorized user can access the file. How can I do so (e.g. hide the path)?
Thanks
You can protect your downloads with auth token. But exact solution depends on what you're using to serve static files.
If your php app is doing that directly, then you should apply auth on the controller responsible for serving files.
In case you have Apache for statics, then take a look here https://code.google.com/p/mod-auth-token/
I believe there are the same solutions for other servers like nginx.

Get files on PHP web service (SOAP)

I have .Net client that sends files.
How can i use PHP web service to get those files and return them after some changes back to client??
I didn't found code to GET those files, maybe someone have a code example...
You can send the file data encoded in Base64 from the client to your PHP web service, and handle them with the $_FILES superglobal. There is a similar topic here : PHP SOAP Transfering Files

Executing JSON link in PHP and parsing the contents

json url :
http://www.nseindia.com/homepage/Indices1.json
I am able to get the json output whenever i am executing this link directly in my address bar of the browser.
When i try to use php file_get_contents() or using curl i am unable to retrieve json output from the above url in my php file on my website on another shared server.
using curl i get the following response :
Access Denied
You don't have permission to access "http://www.nseindia.com/homepage/Indices1.json" on this server.
I need to have that json data decoded using php in my application.
The site is blocking cURL requests. You could likely get around it by spoofing your user agent, but it'd be a bit rude to disrespect their clear desire not to have the JSON data scraped by other servers.

Categories