Get values from url after a specific portion of html - url

I need to go to a specific portion of html through url and get the values from url.
Here is my url.
But if i get the value of 'number_page' as,
$_GET['number_page'] it doesn't return anything.
Is there any solution?

Given you are using PHP(implied from your question) and the 'aTag' in my example is the html code of the page you are at:
<?php
$aTag="";
$pos = strrpos($aTag, "number_page=");
$subStr = substr($aTag,$pos+12);
$pos = strrpos($subStr, "'");
echo substr($subStr,0,$pos);
?>
The output will be 10
You can see it here

Related

window.location in Firefox and Chrome giving me two different returned strings for a Google Macro

My application is using Google Apps Script HTML Service. The URL for Apps Script looks like this:
https://script.google.com/macros/s/AKfycby2Zr2apAai2sIW6eiWTc8yNakGg5M9oLQkmhcz-IRqs22qoJhm/exec
In Firefox, this line of code:
window.daURL = window.location;
returns this:
https://script.google.com/macros/blank
Firefox puts in the word blank. Chrome gives me the entire URL.
What I've been doing, is getting the entire URL, then using Javascript string methods to parse the URL for whatever info I need to check for a Facebook login. The Facebook login appends info to the end of the URL beginning with a hash tag. If the hash tag is there, the code checks for and validates a Facebook login.
I need either the entire URL, or to be able to get an appended string after the /exec.
Chrome gives me the entire URL with window.location, but Firefox will not.
If I try:
window.daURL = window.location.pathname;
Firefox returns:
/macros/blank
If I try:
window.daURL = window.location.search;
I get nothing returned, even when a string is appended to the URL.
I can get a string appended to the URL with the Apps Scripts doGet(e) function:
e.parameter.theNameOfTheStringArg
E.g. www.URL.com?myArg=Something
Use: var getString = e.parameter.myArg
But I can't get a hashed appended value to the URL with doGet(e). I need to check for a hash in the URL.
I figured out that I can use window.location.href to check for the existence of the hash tag appended to the url. So I use window.onload to check for a hashtag in the url, and doGet(e) to check for string attachments to the URL. I need to run both.
<script>
//Script tag in first HTML file that always loads
window.onload=function(){
console.log("This onload did run");
//get the URL out of the browsers address bar
//the URL can have multiple different strings attached depending upon the situation.
//Any situation other than something with a hashtag is initiated in the back end.
window.daURLhash = window.location.hash;
console.log('daURLhash: ' + daURLhash);
window.urlHash = daURLhash.toString();
console.log('urlHash: ' + urlHash);
console.log("url: " + urlHash);
//If a certain situation, there will be a hashtag in the url string
if (urlHash != undefined && urlHash != null) {
if (urlHash.length > 0) {
window.hashExist = true;
console.log('hashExist: ' + hashExist);
};
};
if (window.hashExist === true) {
code here
</script>

Kohana 3.3 get url parameters

My question can look stupid but I need to get in touch and get a decision. I want to pass parameters to url without the parameters being seen in the url. this is to secure my server. Because the url looks like this
controller/edit/123
and the '123' is the user ID in the database.
I can simple do this
public function action_edit($id) {
get_db_info($id);
}
Is it possible to hide the parameter while redirecting to this url from a view? ie in the view file
// Do something to set the ID
<?php Kohana_Request::post("user_id", $id); ?>
Click
and get the ID like this
public function action_edit() {
$id = $this->request->post("user_id");
get_db_info($id);
}
But the problem I can't access the KOhana_Request instance and get this error
*Non-static method Kohana_Request::post() should not be called statically*
Can someone gives a secured approach to this ?
I think I found a solution by encoding and decoding the parameters.
Since Kohana 3.3 do not allow parameters in controller functions see .
I do this in my view
$user_id = Encrypt::instance()->encode($liste->user_id);
$encode_id = base64_encode($user_id);
$encode_ure_id = urlencode($encode_id);
And from the controller,
$encoded_id = urldecode($this->request->param('uri_id'));
$encode_base_url = base64_decode($encoded_id);
$user_id = Encrypt::instance()->decode($encode_base_url);
If this can help others.

HTML code that generate custom url with user given value

Hi i am want an html code that replace XXXXXXXXXXXXXXXXXXX value from my url with my user given value and generate a new url
Below is My URL
https://www.facebook.com/connect/uiserver.php?method=stream.publish&redirect_uri=https://www.facebook.com&api_key=192236710846214 &picture= XXXXXXXXXXXXXXXXXXX%3Flvh%3D1& source=https://dl.dropboxusercontent.com/u/61636013/achille.swf&set=a.106020872877897.12204.100004099541771&type=1&theater &name=Posted by Karthik%C2%AD&caption=Kaur & comment%C2%AD&description=%C2% For Fun
Best is that you use php:
<?php
$x="XXXXXXXXXXXXXXXXXXX";
$location= "https://www.facebook.com/connect/uiserver.php?
method=stream.publish&redirect_uri=https://www.
facebook.com&api_key=192236710846214 &picture=".
$x.
"%3Flvh%3D1& source=https://dl.dropboxusercontent.com
/u/61636013/achille.swf&set=a.106020872877897.12204.
100004099541771&type=1&theater &name=Posted by
Karthik%C2%AD&caption=Kaur & comment%C2%AD&description=%C2%";
header("Lcation:".$location);
?>

Passing url paramaters

Any idea about how can I send parameters in url query and get values of these parameters in next page
In first template I wrote this code
<a href ='r_rss/openOneNews?url={rss_link}'>{rss_title}</a>
Q:How can I get url parameter value in ExpressionEngine and use something like this in following page:
<iframe src = 'url' />
Thanks
See this answer - you want to use Mo' Variables to get the query string, which will then convert to a variable tag:
<iframe src = '{get:url}' />
Ahmed - please don't cross-post your question:
https://expressionengine.stackexchange.com/questions/14546/form-post-values
https://expressionengine.stackexchange.com/questions/14548/sending-paramters-in-url

Replace.string with a URL as parameter

Below I have this code:
string _strTemplate = _strDownloadTemplate + IDReq + "/" + _strFileName;
Uri url = new Uri(_strTemplate);
As you can see, I'm converting the strTemplate (which carries the link of a page that I need to sent by email for the user) to a URL Format. My email body has several fields that I'm replacing with the correct value:
strMailMessage = strMailMessage.Replace("_LinkTemplate", url);
I'm getting an error because the method string.Replace takes strings as parameters only.
Is there a way to get around this?
I was thinking about pass the URL value through my page (page.aspx) but if there's a way to do so through this method, it would be better for me.
Thanks!
Assuming this is C# and .NET, yes, String.Replace() works with strings.
Did you try:
strMailMessage = strMailMessage.Replace("_LinkTemplate", url.ToString());

Resources