get

how to use json file in html code

允我心安 提交于 2019-11-26 23:53:08
I have json file mydata.json , and in this file is some json-encoded data. I want obtain this data in file index.html and process this data in JavaScript. But a don't know how to connect.json file in .html file? Tell me please. Here is my json file: { "items": [ { "movieID": "65086", "title": "The Woman in Black", "poster": "/kArMj2qsOnpxBCpSa3RQ0XemUiX.jpg" }, { "movieID": "76726", "title": "Chronicle", "poster": "/853mMoSc5d6CH8uAV9Yq0iHfjor.jpg" } ] } Thinking that I am getting json file from server, how to use that file in my html, so that I can display the data in tables in html page. I

How to download HTTP directory with all files and sub-directories as they appear on the online files/folders list?

筅森魡賤 提交于 2019-11-26 23:44:39
问题 There is an online HTTP directory that I have access to. I have tried to download all sub-directories and files via wget . But, the problem is that when wget downloads sub-directories it downloads the index.html file which contains the list of files in that directory without downloading the files themselves. Is there a way to download the sub-directories and files without depth limit (as if the directory I want to download is just a folder which I want to copy to my computer). 回答1: Solution:

Sanitizing user's data in GET by PHP

a 夏天 提交于 2019-11-26 23:32:00
How do you sanitize data in $_GET -variables by PHP? I sanitize only one variable in GET by strip_tags . I am not sure whether I should sanitize everything or not, because last time in putting data to Postgres, the problem was most easily solved by the use of pg_prepare . How do you sanitize data in $_GET -variables by PHP? You do not sanitize data in $_GET. This is a common approach in PHP scripts, but it's completely wrong*. All your variables should stay in plain text form until the point when you embed them in another type of string. There is no one form of escaping or ‘sanitization’ that

PHP $_GET and $_POST undefined problem

流过昼夜 提交于 2019-11-26 23:24:51
问题 I'm new to PHP so I apologize if this is a simple problem... I am moving a PHP site from one server to another. The new server is IIS 7.0, PHP 5.2.1, with short open tag turned "On", and I don't know how the original server was set-up (I was just given the code). The following is the very first section of code on one of the pages: <? ob_start(); session_start(); if($_GET['confirm'] == 13 || $_GET['confirm'] == 14 || $_GET['confirm'] == 15 || $_GET['confirm'] == 16) { include("test/query/test

PHP - hide url (GET) parameters

核能气质少年 提交于 2019-11-26 23:07:08
问题 I have a link in my PHP/HTML like this: <a href="http://search.mywebsite.com/login.aspx?checktype=uid&user=adam&password=pass1234&profile=dart&defaultdb=kts"> Log me into this website </a> When users click on the link, the parameters are handled by a 3rd party website which log the users in seamlessly. Is it possible to hide/mask/camouflage the url so that users don't see the parameters while still passing them over to the designated site? If no, how would you guys go about this? I'm mainly

Parametrized get request in Ruby?

一世执手 提交于 2019-11-26 22:38:23
问题 How do I make an HTTP GET request with parameters in Ruby? It's easy to do when you're POST ing: require 'net/http' require 'uri' HTTP.post_form URI.parse('http://www.example.com/search.cgi'), { "q" => "ruby", "max" => "50" } But I see no way of passing GET parameters as a hash using 'net/http' . 回答1: Use the following method: require 'net/http' require 'cgi' def http_get(domain,path,params) return Net::HTTP.get(domain, "#{path}?".concat(params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }

How can I get the title of a webpage given the url (an external url) using JQuery/JS

旧时模样 提交于 2019-11-26 22:12:29
I am a newbie, so excuse me if this is a silly question .. So what I was trying is to get the title of a URL using JQuery/JS. I dont want to load the content of the url and then parse tags in it. Let me be more clear, I have a set of urls, say 20 for which I want to display the titles .. the urls i am referring to are not the current urls, so I cant use js document.title .. so i want to do something of the form SOMEFUNC.title(URL) and get its title. Is there any such function? Durgesh You can also get the title of any webpage using this API http://textance.herokuapp.com/title/ $.ajax({ url:

How to check if $_GET is empty?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 22:10:16
How to check if $_GET is empty? You said it yourself, check that it's empty : if (empty($_GET)) { // no data passed by get } See, PHP is so straightforward. You may simply write, what you think ;) This method is quite secure. !$_GET could give you an undefined variable E_NOTICE if $_GET was unset (not probable, but possible). i guess the simplest way which doesn't require any operators is if($_GET){ //do something if $_GET is set } if(!$_GET){ //do something if $_GET is NOT set } Just to provide some variation here: You could check for if ($_SERVER["QUERY_STRING"] == null) it is completely

Is it possible to preserve plus signs in PHP $_GET vars without encoding?

假装没事ソ 提交于 2019-11-26 22:04:47
问题 Say I request this URL: http://mydomain.com/script.php?var=2+2 $_GET['var'] will now be: "2 2" where it should be "2+2" Obviously I could encode the data before sending and then decode it, but I'm wondering if this is the only solution. I could also replace spaces with plus symbols, but I want to allow spaces as well. I simply want whatever characters were passed, without any url decoding or encoding going on. Thank you! 回答1: Of course. You could read out $_SERVER["QUERY_STRING"] , break it

Why doesn't requests.get() return? What is the default timeout that requests.get() uses?

China☆狼群 提交于 2019-11-26 22:04:28
In my script, requests.get never returns: import requests print ("requesting..") # This call never returns! r = requests.get( "http://www.justdial.com", proxies = {'http': '222.255.169.74:8080'}, ) print(r.ok) What could be the possible reason(s)? Any remedy? What is the default timeout that get uses? What is the default timeout that get uses? The default timeout is None , which means it'll wait (hang) until the connection is closed. What happens when you pass in a timeout value? r = requests.get( 'http://www.justdial.com', proxies={'http': '222.255.169.74:8080'}, timeout=5 ) Hieu From