Jump to content

Error on passing Url through form


heeha
 Share

Recommended Posts

I was using a api from google but whenever i pass it though a form via post, it gets me error.

Invalid value ''.https://google.com.'/'. Values must match the following regular expression: '(?i)http(s)?://.*' [locationType] => parameter [location] => url ) ) [code] => 400 [message] => Invalid value ''.https://google.com.'/'. Values must match the following regular expression: '(?i)http(s)?://.*' ) )

 

<?php 
if(isset($_POST['url'])){
    $url = $_POST['url'];

( I hid code rest code because of api But i get above error. ) 


	$val = json_decode($result, true);

	//return $val;
    
    print_r($val);
 
}
?>

<form action="" method="post">
Url <input type="url" name="url">
</form> 

 

What should be added to pass url variable correctly? I tried using w3school method but i still get the same error.

Edited by cyberRobot
extracted non-code from code block
Link to comment
Share on other sites

W3school is the last resource you should try. In any case the code you omitted is the code we need to see, particularly the headers you are setting to send. Yo don't send post data in the UR per se. Are you using curl or pecl?

Edited by gw1500se
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.