get

How to view the last GET HTTP request in JavaScript

ε祈祈猫儿з 提交于 2019-11-29 10:24:13
How can I view the last GET http request in JavaScript? Basically what I am after is what I can see my firebug console. When XMLHttpRequests are showing in console I see a line that looks something like: GET http://www.domain.com/php/file.php?q0&c=1 200 OK 163ms How do I view that URL in JavaScript? EDIT: Just to be clear I'm looking for the URL between GET... and ...200. I don't care about anything else. I don't want any of the other info. You may want to modify the XMLHttpRequest.prototype.open to decorate it with your "tracking" code. Something like this: var ajaxCalls = []; XMLHttpRequest

PHP safe $_GET or not

爱⌒轻易说出口 提交于 2019-11-29 09:43:23
We have url: http://site.com/index.php?action=show $_GET['action'] is used in templates to check value of ?action= : switch ($_GET['action']) { case = "show" { $match_show = true; } } and in other place: echo $_GET['action']; Is it absolutely safe to use this constructions? How to make them safe? Thanks. The switch thing is okay, because you are comparing against a hard-coded value (however, it's case "show": btw). As @Bruce mentions in the comments, you should add a default: case as well to catch values that are not on the list, or empty values: switch ($_GET['action']) { case "show": $match

Empty GET variables displaying in the URL

一个人想着一个人 提交于 2019-11-29 08:48:28
Here is my form : <?php echo '<form method="get" action="" name="formulaire">'; echo '<input type="text" name="info1" title="" value="" />'; echo '<input type="text" name="info2" title="" value="" />'; echo '<input type="text" name="info3" title="" value="" />'; echo '<input type="submit" value="Envoyer" />'; echo '</form>'; echo '$info1 = '.$_GET["info1"].'<br />'; echo '$info2 = '.$_GET["info2"].'<br />'; echo '$info3 = '.$_GET["info3"].'<br />'; ?> My problem is that after submitting, all the variables are displayed in the URL, even if they are empty. I would like the non-empty variables

How can I log in to morningstar.com without using a headless browser such as selenium?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 08:41:27
I read the answer to the question: "How to “log in” to a website using Python's Requests module?" The answer reads: "Firstly check the source of the login form to get three pieces of information - the url that the form posts to, and the name attributes of the username and password fields." How can I see, what the name attributes for username and password are for this morningstar.com page? https://www.morningstar.com/members/login.html I have the following code: import requests url = 'http://www.morningstar.com/members/login.html' url = 'http://beta.morningstar.com' with open('morningstar.txt')

Storing php $_GET variable in a javascript variable? [duplicate]

为君一笑 提交于 2019-11-29 08:16:47
This question already has an answer here: How do I pass variables and data from PHP to JavaScript? 19 answers I am passing two pieces of info to a php page using the $_GET method (team1, team2). I'd like to use these as variables in some javascript. How can I do this? Thanks Original answer: In your .php file. <script type="text/javascript"> var team1, team2; team1 = <?php echo $_GET['team1']; ?>; team1 = <?php echo $_GET['team1']; ?>; </script> Safer answer: Didn't even think about XSS when I blasted this answer out. (Look at the comments!) Anything from the $_GET array should be escaped,

Looping through assets in Vue.js static directory

丶灬走出姿态 提交于 2019-11-29 08:13:21
I've created a simple app in Vue (using the Webpack template) that has a carousel in it. What I would like to do is loop through all of the images in static/images to create that carousel. I know this is probably a dumb question, but how would I go about doing this? Do I need to perform a GET request? The reason I'm asking is because I'm going to hand this off to a client to be hosted on their server. They would like to be able to add additional images to the carousel themselves if needed. Any help would be appreciated. JavaScript can't directly access the contents of a file system. You'll

How to handle C# .NET GET / POST?

非 Y 不嫁゛ 提交于 2019-11-29 06:36:24
问题 As I'm new to .NET after coming from PHP I chose C# to work with and its coming along nicely. I have a question though regarding the handling of GET and POST. So far I've established that I can put this in the codefile behind the aspx page: if (Request.HttpMethod.ToString() == "POST") { Response.Write("You sent a post!") } and I could and an ELSE there to handle a GET, but how exactly would you do that? In PHP I would do something like this: Example URL = http://www.example.com/page.php?foo

How to keep already-set GET parameter values on form submission?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 05:28:10
I have a URL : foo.php?name=adam&lName=scott , and in foo.php I have a form which gives me values of rectangleLength & rectangleBreadth with a submit button. When I click this submit button with form action as $_SERVER['REQUEST_URI'] , I get this result URL: foo.php?rectangleLength=10&rectangleBreadth=5 (these values have been filled in by the user). Notice that I am losing my previous values name & lName from the URL. How can I keep them? Also, keep in mind that I have to come back to foo.php and if the user wants to submit the form again then the length and breadth values should change. You

is link / href with just parameters (starting with question mark) valid?

元气小坏坏 提交于 2019-11-29 04:33:54
问题 Is this link valid? <a href="?lang=en">eng</a> I know the browsers treat it as expected and I know the empty link would be ok too - but is it ok to specify just the parameters? I am curious because question mark ("?") is only a convention by most HTTP servers (AFAIK), though I admit it is a prevailing one. So, to recap: will all browsers interpret this correctly? is this in RFC? can I expect some trouble using this? UPDATE: the intended action on click is to redirect to the same page, but

Angular JS - request in order to get an image

三世轮回 提交于 2019-11-29 04:09:22
I would like to display a jpeg image on UI. For this, I request my service (GET method) and then I converted to base 64: $http({ url: "...", method: "GET", headers: {'Content-Type': 'image/jpeg'} }).then(function(dataImage){ var binary = ''; var responseText = dataImage.data; var responseTextLen = dataImage.data.length; for (var j = 0; j < responseTextLen; j+=1) { binary += String.fromCharCode(responseText.charCodeAt(j) & 0xff) } base64Image = 'data:image/jpeg;base64,' + window.btoa(binary); }); In the end, my browser tells me that the image is corrupt or truncated. So I tried creating a