I want a way to know the available or allowed arguments in url
for example:
http://www.example.com/?name=aaa&id=123
but there might be another parameters but it is not visible like ( age=555&email=aa#bbb.com)
so most of urls will work even if I pass 1 parameter especially for search engine
but how can I know the available arguments that I can use?
thank you
The arguments that a particular URL can accept are determined by the site's author. If they don't publish that information the only way you can know a particular argument is acceptable is to submit it and see whether you get an error response. Even then you won't know what range of values are acceptable.
Related
Is it possible to get the comment count of multiple urls by doing one HTTP request? To get the comment count of one url at the time, I use the following url:
https://graph.facebook.com/https://www.google.com/
According to the documentation, you need to use "batch=" but this does not work. If it is possible, could you please supply an example?
Thanks!
https://developers.facebook.com/docs/graph-api/using-graph-api/#multiidlookup
https://graph.facebook.com/?ids=https://www.google.com/,http://example.com/
Make sure to apply proper URL encoding to the individual URLs, to avoid problems with characters that have a special meaning in the URL query string. So that request above should look like this,
https://graph.facebook.com/?ids=https%3A%2F%2Fwww.google.com%2F,http%3A%2F%2Fexample.com%2F
For a given url, I want to get the name-after-hash's age from the database. so for url like thepage.php#Madonna, you'll see "119!".
How can I extract the value after the hash in a url? (i need a safe all-browser-compatible-NON-JAVASCRIPT way). I want to do that like $_GET['after hash'].
The reason I'm not using GET is because I want to use AJAX and jquery's history plugin.
Basically what i want is to use ajax to retrieve data from the server according to the value assigned after the hash.
I don't think it's possible. The string after # is interpreted by the browser as an anchor name within the current page. It is not passed to the server.
Javascript
window.location.hash will give you this value. You can then pass it (via AJAX) to the server for results.
PHP
Check the Fragment of parse_url();
Return Values
On seriously malformed URLs, parse_url() may return FALSE and emit a E_WARNING. Otherwise an associative array is returned, whose components may be (at least one):
scheme - e.g. http
host
port
user
pass
path
query - after the question mark ?
fragment - after the hashmark #
This question didn't make much sense, you need to clarify it.
You want to hash the URL without Javascript, but in a way that can be used by Ajax?
i'm very new to Yii, Normally yii serve like this url format
baseurl/app_dir/conroller/action/parametername/vaule
But i want to show up it like this
baseurl/app_dir/conroller/action/vaule
means without parameter name.
i read lot of solutions but couldn't find, does anybody knows how to do it, please help me.
It is somewhere in docs, here is example:
'/user/<id:\w+>/' => 'user/view/'
This means, that request /user/someUserName will be directed to action view in controller user with parameter id with value someUserName. This way you have urls with just value, but in application it is available as named $_GET parameter.
NOTE: \w+ is just regex, which are supported here, you could for example use \d+ to limit value to numeric etc.
I'm writing an app that allows you to filter database results based on Location and Category.
If someone was to search for Liverpool under the Golf category the URI would be /index.php/search/Liverpool/Golf.
Should someone want to search by Location but not category, they would be sent to /index.php/search/Liverpool
However, should someone want to filter only by category they would be unable to use /index.php/search/Golf because that would be caught by the location search.
Is there a best practice way to have /index.php/search/Golf be recognised? Some best practice as to what else to add to the URI to make these two queries distinct? /index.php/search/category/Golf perhaps?
Though that is beginning to show characteristics of /index.php?search&category=Golf which is exactly what I'm trying to avoid.
Try using $this->uri->uri_to_assoc(n)
described here http://codeigniter.com/user_guide/libraries/uri.html (half way down on page)
basically you will structure your url like this:
mysite.com/index.php/search/location/liverpool/category/golf
NOTE: the parameters are optional so you dont have to have both in there all the time. you can just as well do
mysite.com/index.php/search/location/liverpool/
and
mysite.com/index.php/search/category/golf
this way it will return FALSE if the element you are looking for does not exist
It would probably be best to keep your URI segments relavent no matter what they are searching for.
index.php/LOCATION/CATEGORY
If they are not interested in a location then pass a filler to the system:
index.php/anywhere/golf
Then in your code you just check for that specific string of ANYWHERE to determine if they only want to see the activity. I assume that you are going to be redirecting them with either links or forums (and that they aren't typing the URI string themselves) so you should be safe in just passing information that you expect and testing against that.
I use the format suggested by Tom above and then do something along the lines of below to determine the value of the parameters.
$segment_array = $this->uri->segment_array();
$is_location_searched = array_search('location', $segment_array);
if($is_location_searched && $this->uri->segment($is_location_searched +1))
{
$location = $this->uri->segment($is_sorted+1);
}
Have a look at http://lucenebook.com/#/p:solr/s:wiki and click around a bit on the left-hand navigation. Pay close attention to what happens in the url when you do. I really like this scheme for many reasons.
It's SEO-friendly.
"Curious" people can mix/match the urls and it still resolves to a proper search.
It just looks good!
Of course, the trick is really in the code, in how you build the thing. It took me a few weeks to sort it out, but I finally have my own version of that site. Just not ajax based, because I like search engines better than ajax. Ajax don't pay the bills.
For a given url, I want to get the name-after-hash's age from the database. so for url like thepage.php#Madonna, you'll see "119!".
How can I extract the value after the hash in a url? (i need a safe all-browser-compatible-NON-JAVASCRIPT way). I want to do that like $_GET['after hash'].
The reason I'm not using GET is because I want to use AJAX and jquery's history plugin.
Basically what i want is to use ajax to retrieve data from the server according to the value assigned after the hash.
I don't think it's possible. The string after # is interpreted by the browser as an anchor name within the current page. It is not passed to the server.
Javascript
window.location.hash will give you this value. You can then pass it (via AJAX) to the server for results.
PHP
Check the Fragment of parse_url();
Return Values
On seriously malformed URLs, parse_url() may return FALSE and emit a E_WARNING. Otherwise an associative array is returned, whose components may be (at least one):
scheme - e.g. http
host
port
user
pass
path
query - after the question mark ?
fragment - after the hashmark #
This question didn't make much sense, you need to clarify it.
You want to hash the URL without Javascript, but in a way that can be used by Ajax?