How to send a post request to GTMetrix

309 views Asked by At

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?

3

There are 3 answers

0
DiegoRBaquero On BEST ANSWER

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.

0
Johannes Jander On

I am not familiar with gtmetrix, but you need to set the name attribute on your input to send it with the request.

0
Dirk Jan On

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.