How to add external link from Database in laravel? - html

In my Laravel project I have created a input field where facebook account link will be given as input. This input will store in the database. Then I create an object of that table and used the link in tag. i was expecting that this will take me to the given facebook account link. But it is creating a route like this /link. How can I solve this.
This code is for input field
<div class="form-group col-md-12">
<label for="name" class=" form-control-label">
Facebook ID
<span class="reqfield">*</span>
</label>
<input type="text" id="fb_link" placeholder="Facebook ID" class="form-control" name="fb_link" required value="{{$data->fb_link}}">
</div>
And this code is for Showing the link:
</li><li><span class="fa fa-play"></span>Facebook
The file is Here

Its the client browser that does this. Nothing to do with Laravel or blade
If a href does not start with a protocol then it is assumed to be local to the current site.
You need to check the link when it is given to you, and if it starts http:// ot https:// then leave it alone, otherwise add http:// to the url before you save it in the database.
Force the URL to lowercase before you check incase they gave HTTP:// or even hTTp://

It's because your URL is missing the PROTOCOL ( http, https, etc. )
You need to append a valid protocol with the URL before saving to the database or in your view.
Example, in your view:
</li><li><span class="fa fa-play"></span>Facebook
You can also use the Laravel's inbuild validation method to check if the
entered URL by the user is valid or not. Check https://laravel.com/docs/7.x/validation#rule-url

Related

How to find out what url HTML button submits to

So I'm scraping a website (instacart.com) and it requires a zip code to determine what data it displays. I want to use Python requests to post an arbitrary zip code. The only problem is I don't know what url to post it to and whether it requires any other arguments like an authenticity token or a user cache key. The zip code is entered via an text box that looks like this:
<form data-radium="true">
<input id="postalcode-16749"
name="postal_code"
type="text"
aria-invalid="false"
aria-describedby=""
autocomplete="on"
placeholder=""
data-radium="true"
value="" style=(super long block of css stuff)>
</form>
and then posted via a button that looks like this:
<button type="submit"
data-radium="true"
style="touch-action: manipulation; (long block of more css)">
Continue
</button>
I don't know a lot about web programming, but I was taught in school that HTML forms would look more like this: <form action="/action_page.php" method="get"> and you could use the action attribute to find where it was posting to. Is there a way to use the developer console to find what I'm looking for? How can I post a zip code to this website with Python?
Edit: I did a little more digging and I found that the request payload is {"current_zip_code":"some_zip_code"}, and that it's actually not using POST, it's using PUT. There's still a problem though, the request url looks like this: https://www.instacart.com/v3/bundle?source=web&cache_key= and then there's a different code each time for the cache_key. How do I know what url to post to?
I'm posting this answer in case anyone tries to do a similar thing. I found the url the button posts to and its parameters by looking in the network tab of the developer console and clicking the button. Then I ran into the problem that the url it sends the PUT request to changes every time, always ending in a different cache_key.
The solution was to use a python module called seleniumwire to simulate a browser and then grab all the network traffic. From there I looped through it and found urls containing cache_key= and stored everything after that as a string. Then tacked that string to the end of this url: https://www.instacart.com/v3/bundle?source=web&cache_key= and went back to using requests.
hope this helps someone!

What happens when submitting an html form? (the process behind the scenes)

Can someone please tell me what happens behind the scenes in the following case (i.e. explain the whole technical process)?
<form method="get" action="#">
<input type="text" name="d" value="flowers">
<button type="submit">send</button>
</form>
In this case after one has clicks on “send” a new webpage opens saying: "You have searched for "flowers" " and an image of some flowers below.
In the browser tab right after the URL of the newly opened page there is
“/?s=flowers”. What is that?
Thank you in advance for your answers!
When you click Send, the page data specified in the form information and values is passed to the server via HTTP.
The /?s=flowers is the GET data being passed back to the server. Although, based on the form code you've provided, the "name" of that value is d. So the URL would actually have /?d=flowers
The PHP or server side language then handles that information to do specific tasks. It can access the info using the name "d". This method of sending data is called GET, there are also other ways of doing this. The most common, POST, does not display the data in the URL and send the data through HTTP headers.
The code you've shown has an action of "#" which means the HTTP method is being sent the same page. Meaning this page code would have some PHP located in it. This can also be done by using a seperate file, such as action='send.php'

How to send a post request to GTMetrix

I want my users to write his website on my site and then be sent to gtmetrix.com to start a new test, but without needing to write his website again.
I am trying with this:
<form method="post" action="https://gtmetrix.com/analyze.html">
<input type="text" placeholder="Enter your Website URL"></input>
<input type="submit">CHECK IT</input>
</form>
But i get a
Analysis Error
You tried to analyze an invalid/malformed URL
What i am doing wrong? is possible to do this?
It seems they require the url in the form data field called url.
You must use the following input tag:
<input type="url" name="url" value="" placeholder="Enter your website URL" maxlength="1024" autofocus="" required="">
Also, they could be blocking external referrers. But first try adding the name attribute.
First of all, I don't know if that website allows you to submit that form from external websites. Make sure that's possible!
Seccond of all, you are trying to sent a form without setting the name of the input field. The resource that receives your request don't know anything to do with it.
If you want to analyse websites on your own website, search for services that provide APIs for using it external.
I am not familiar with gtmetrix, but you need to set the name attribute on your input to send it with the request.

I have no knowledge beyond html. How do I make this form work?

So, I'm making a couple changes to a website, since my boss is cheap and does not want to pay anyone to do it.
I am trying to add a form on a web page that lets a user type in a first and last name. They will then get a page saying verified with a picture of the person if they are in the database. Or, they will receive a page with a message that the person is unknown.
This is for the general public to verify if someone who represented our company is a valid employee or not.
So, what I have so far is the following code, which I am competant enough to put together to style the form (computer class 10+ years ago). But I have NOOOOO IDEA where to go from here. Please help me, and assume I am clueless, because I am! :)
<div class="sidebar_right_bottom">
<h3>Rep Verification</h3>
<div class="login_form">
<p><center>Enter the name of the rep who contacted you to verify their identity.</center></p>
<form>
<div>
<span><label>First Name</label></span>
<span><input name="userfirstname" type="text" class="textbox"></span>
</div>
<div>
<span><label>Last Name</label></span>
<span><input name="userlastname" type="text" class="textbox"></span>
</div>
<div>
<span><input type="submit" class="mybutton" value="Submit"></span>
</div>
</form>
</br>
</div>
</div>
</div>
<div class="clear">
This is what the code generates using css:
[![enter image description here][1]][1]
So, now... I have a styled form on the page, how do I get it to submit, check against a database, and return a page with the info on it for the user?
More Info:
We bought the domain through godaddy and have simply bought the cpanel hosting and written basic html. I am attaching screenshots of what I have access to:
22
Also, I don't know if this helps:
Server: Localhost via UNIX socket
Server type: MySQL
Server version: 5.5.42-cll-lve - MySQL Community Server (GPL)
Protocol version: 10
Server charset: UTF-8 Unicode (utf8)
Sorry for being so clueless here...
In your tag, you will need to specify the action and method when the submit button is clicked. You would like to visit this website on how submitting works.W3School Form
in Form tag add
<Form method="POST" action="test.xxx">
That way when someone push submit button the request will go to test.xxx site. Now you will only need to create a serverside script to check the database.
Unfortunately we do not know anything about your server so we do not know if it runs php, java or anything else. Please post that information and information about your database so we can help.
Edit: In that case, from your image i suspect you may have php. But there is still some information we need.
Create on server a file, name it : test.php
inside of this file paste this code:
<?php phpinfo(); ?>
And redirect your webbrowser to this file.
If you have php installed you'll see a bunch of tables with a lot of info. We could use php version and mysql connection type. You can search for pdo and mysqli :)

How can I find a website's login form URL variables?

I am trying to make a code that will automatically login into a webpage for you, but I am having trouble finding the url variables for the submission.
How can I find the url variables to submit the login?
i.e.
https://login.fidelity.com/ftgw/Fas/Fidelity/RtlCust/Login/Init
When I submit my username and password on the site, it passes it through to
https://login.fidelity.com/ftgw/Fas/Fidelity/RtlCust/Login/Response
The username <input> has id="userId", and the password <input> has id="password", and this is all under a <form> which has method="POST"
How can I find all variables that I need to submit?
The URL variables aren't always in the URL.
Most Login forms use a method of transferring that data called "POST".
In which the URL data cannot be seen by the user.
You can try using http://www.wireshark.org/ or http://www.charlesproxy.com/ to view the data sent and received by your web browser.
To find the name of the URL parameters (such as ?username=....&pas=...).
You can look into the HTML of the page. Look for something like so:
<form action="login.php" method="post">
<input type="text" name="username" value="User Types Username Here">
<input type="submit">
</form>
Can use Chrome (Ctrl + Shift + J) Network tools. Click "Preserve Log" to ensure you capture payload before page refreshes.