Posts

Showing posts with the label url

How to preserve '+' sign in params in rails 5

How to preserve '+' sign in params in rails 5 I have an uri like this /store?email=google+@gmail.com . Since '+' sign is allowed in email address, I need to preserve the plus sign. However, in rails 5, if I use params[:email] , I get google @gmail.com instead. How to prevent rails from converting '+' into space? I know we can first encode the url, and then decode it to preserve the '+' sign, but can I directly use params instead of extracting params from uri? Is there a way to preserve the plus sign in params ? /store?email=google+@gmail.com params[:email] google @gmail.com params params Also I tried using URI.decode_www_form_component params[:email] ,which still didn't work. And since the url is provided by external source I can't ask them to explicitly encode + as %2B . URI.decode_www_form_component params[:email] + %2B Any suggestions will be appreciated! How are you using that URI? Some things will URI escape,...

Creating a custom url for an static html page

Creating a custom url for an static html page I need to create a page like http://www.example.com/strong and the file to support that are inside my docroot/strong/index.html . http://www.example.com/strong docroot/strong/index.html Inside my docroot there are other folders with their index file as well. For example docroot/site1/index.html docroot/site2/index.html docroot/strong/index.html docroot/site1/index.html docroot/site2/index.html docroot/strong/index.html So when user types in http://www.example.com/strong it should open docroot/strong/index.html without changing the URL. Can I achieve this? http://www.example.com/strong docroot/strong/index.html if you have directoryindex set as index.html in http.conf you have to do nothing. – Abhishek Gurjar 2 days ago By cli...

Callback url for Android intent

Callback url for Android intent I'm working with a payment solution with another company, and in their API i have to send my callback url for when the transaction is complete. Are there any way to find the url to my application? My application is opening the payment application with an url, and after it's dont it should redirect to my application. Any ideas on how i can solve this? Some sample code bellow on how i open the payment application: Intent vippsIntent = openVipps(getContext(), finalURL); startActivity(vippsIntent); public static Intent openVipps(Context context, String url){ try{ context.getPackageManager().getLaunchIntentForPackage("no.dnb.vipps"); return new Intent(Intent.ACTION_VIEW, Uri.parse(url)); }catch (Exception e){ return new Intent(Intent.ACTION_VIEW, Uri.parse(url)); } } developer.android.com/training/app-links/deep-linking – Tim Castelijns ...

Is it possible to check if a certain url is redericting without opening a request to the site in Python? [duplicate]

Is it possible to check if a certain url is redericting without opening a request to the site in Python? [duplicate] This question already has an answer here: I know that it is possible to check if a URL redirects, as mentioned in the following question and its answer. How to check if the url redirect to another url using Python using the following code: eq = urllib2.Request(url=url, headers=headers) resp = urllib2.urlopen(req, timeout=3) redirected = resp.geturl() != url # redirected will be a boolean True/False However, I have list of Millions of URLs. Currently it is discussed wether one of them is a harmful URL or redirects to a harmful URL. I want to know if it is possible to check for redirect without opening a direct connection to the redirecting website to avoid creating a connection with a harmful website? This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. Do...

PHP Fatal error: Uncaught UnirestException: Bad URL

PHP Fatal error: Uncaught UnirestException: Bad URL I'm trying to request a REST API using PHP Unirest. The printed error is the following: Bad URL, colon is first character And my code: <?php require __DIR__ . '/../vendor/autoload.php'; use UnirestRequest as UniRequest; use CurlFile; if (isset($_POST['primeiro'])) { $where = $_POST["where"]; $equal = $_POST["equal"]; $resultado = new pedidos; $valores = $resultado->LogIgualA($where, $equal); } class pedidos { function LogIgualA($where, $equal) { $wsURL = "localhost:8080/public"; try { $valores = UniRequest::get($wsURL."/visual/json_log/where=".$where."/equal=".$equal, $headers, null); } catch (Exception $e) { echo $e->getMessage(); } $valoresAux = $valores->body; $valores = ; foreach($valoresAux as $z){ $ID = $z->ID; $DateConnect...

Laravel route segment

Laravel route segment I wanna write a route Route::get('/{lang}/home', 'ExampleController@get_home') , so Route::get('/{lang}/home', 'ExampleController@get_home') so lang maybe exists or not? How can I do this? Use a regex: laravel.com/docs/5.6/… – DigitalDrifter Jun 29 at 9:09 2 Answers 2 Laravel doesn't allow optional parameter in middle of route. However, you can resolve it by adding 2 route like this Route::get('/home', 'ExampleController@get_home') Route::get('/{lang}/home', 'ExampleController@get_home') Controller (add $lang optional param in your controller action) class ExampleController extends Controller { public function get_home(Request $request, $lang = null){ ... ...

Get the full URL in PHP

Get the full URL in PHP I use this code to get the full URL: $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; The problem is that I use some masks in my .htaccess , so what we see in the URL is not always the real path of the file. .htaccess What I need is to get the URL, what is written in the URL, nothing more and nothing less—the full URL. I need to get how it appears in the Navigation Bar in the web browser, and not the real path of the file on the server. @Brade URL bar is on the user browser, so why would PHP have any functionalities regarding that? PHP is server side. – eis Oct 19 '13 at 11:53 @eis Believe me, there's plenty of reasons to want this. Landing pages that use the same template but need to be tracked separately, etc. And the fact is that PHP (...