get

Get last word from URL after a slash in PHP

北战南征 提交于 2019-11-27 22:54:54
I need to get the very last word from an URL. So for example I have the following URL: http://www.mydomainname.com/m/groups/view/test I need to get with PHP only "test", nothing else. I tried to use something like this: $words = explode(' ', $_SERVER['REQUEST_URI']); $showword = trim($words[count($words) - 1], '/'); echo $showword; It does not work for me. Can you help me please? Thank you so much!! by using regex: preg_match("/[^\/]+$/", "http://www.mydomainname.com/m/groups/view/test", $matches); $last_word = $matches[0]; // test Use basename with parse_url: echo basename(parse_url($_SERVER[

PHP - hide url (GET) parameters

南楼画角 提交于 2019-11-27 22:38:09
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 worried about the user and password params and need those hidden. (user=adam&password=pass1234) The only

iOS Can't perform HTTP GET request -Error Domain=NSURLErrorDomain Code=-1012

一世执手 提交于 2019-11-27 22:12:32
问题 I am trying to perform a HTTP Get request, but I keep on getting Error Domain=NSURLErrorDomain Code=-1012 error. MY code is : @try { NSString *url = [[NSString alloc] initWithFormat:@"%@%@", @"http://api.mintchat.com/agent/chats/", agentSecret]; NSLog(@"******Agents Active List URL Str - %@", url); NSURL *nsUrl = [NSURL URLWithString:url]; NSLog(@"******Agents Active List URL - %@", nsUrl); // Make the request, returning a JSON response, just as a plain old string. //NSData *jsonDataString =

How to set Cookies at Http Get method using Java

廉价感情. 提交于 2019-11-27 22:09:55
I want to do a manual GET with cookies in order to download and parse a web page. I need to extract the security token, in order to make a post at the forum. I have completed the login, have read the response and extracted the cookies (3 pairs of (name,value) ). I then wrote the String containing the cookies like this: CookieString="name1=value1; name2=value2; name3=value3" I then do the following HttpURLConnection connection connection = (HttpURLConnection)(new URL(Link).openConnection()); connection.setRequestMethod("GET"); connection.setRequestProperty("Connection", "Keep-Alive");

What happens when submit button is clicked

旧时模样 提交于 2019-11-27 22:04:38
问题 What happens when submit button is clicked? Let I've a form which located on an http://example.com/ URL with the two input elements like this: <form method="get"> <input type="text" id="field1" name="namefield1"/> <input type="text" id="field2" name="namefield2"/> <input type="submit" value="submit"/> </form> What actually get request will be sent to an http -server in my specific case? 回答1: The form will be submitted to the server and the browser will redirect away to the current address of

Is $.get of jquery asynchronous?

一世执手 提交于 2019-11-27 21:59:26
I was wondering whether I should use asynchronous calls on my website or not. I know to specify this explicitly I need to use $.ajax however initially I tried using $.get and although the server had to return lots of information, my browser didn't stuck and I could navigate without any problems. I searched a little bit online about it, however I'm still not 100% certain about the difference between the two. If $.get is asynchronous then what's the point of $.ajax ? And if it's not, then again seeing how I had no navigation problems with $.get , what's the point of using $.ajax ? thanks in

Javascript access another webpage

血红的双手。 提交于 2019-11-27 21:26:05
问题 I know very, very little of javascript, but I'm interested in writing a script which needs information from another webpage. It there a javascript equivalent of something like urllib2? It doesn't need to be very robust, just enough to process a simple GET request, no need to store cookies or anything and store the results. 回答1: There is the XMLHttpRequest, but that would be limited to the same domain of your web site, because of the Same Origin Policy. However, you may be interested in

Get only filename from url in php without any variable values which exist in the url

两盒软妹~` 提交于 2019-11-27 21:01:41
I want to get filename without any $_GET variable values from a url in php? My url is http://learner.com/learningphp.php?lid=1348 I only want to retrieve the learningphp.php from the url? How to do this? Please help. I used basename but it gives all the variable values also- learntolearn.php?lid=1348 which are in the url. This should work: echo basename($_SERVER['REQUEST_URI'], '?' . $_SERVER['QUERY_STRING']); But beware of any malicious parts in your URL. Use parse_url() as Pekka said: <?php $url = 'http://www.example.com/search.php?arg1=arg2'; $parts = parse_url($url); $str = $parts['scheme'

PHP - Get array value with a numeric index

空扰寡人 提交于 2019-11-27 20:59:51
I have an array like: $array = array('foo' => 'bar', 33 => 'bin', 'lorem' => 'ipsum'); echo native_function($array, 0); // bar echo native_function($array, 1); // bin echo native_function($array, 2); // ipsum So, this native function would return a value based on a numeric index (second arg), ignoring assoc keys, looking for the real position in array. Are there any native function to do that in PHP or should I write it? Thanks $array = array('foo' => 'bar', 33 => 'bin', 'lorem' => 'ipsum'); $array = array_values($array); echo $array[0]; //bar echo $array[1]; //bin echo $array[2]; //ipsum

Making href (anchor tag) request POST instead of GET? [duplicate]

前提是你 提交于 2019-11-27 20:27:47
This question already has an answer here: Make a link use POST instead of GET 10 answers <a href="employee.action" id="employeeLink">Employee1</a> when i click the Employee1 link, GET request goes to server. I want to make it POST instead of GET request. Is there a way i can change default GET behaviour of href? Note:- I know it can be done where we can call javascript function on hyperlink click , then create form and submit it. But i am looking where we can mention some attribute in anchor tag to make POST request instead of GET request? Using jQuery it is very simple assuming the URL you