Jump to content

heeha

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by heeha

  1. 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.
  2. I am trying to echo the right answer but I always get the wrong one. <?php $gplus= 344; if($gplus >= 1){ echo "Get answer 1."; } else if($gplus >= 50) { echo " Get answer 2."; } else if ($gplus >= 100) { echo " Get answer 3."; } else if($gplus >= 200) { echo "Get answer 4"; } else if($gplus >= 500){ echo "Get answer 5."; } else if($gplus >= 1000){ echo "Get answer 5."; } else if($gplus >= 2000) { echo " Get answer 6."; } else if($gplus >= 3000) { echo " Get Answer 7."; } else { echo "We didn't find any answers."; } ?> $gplus is 344, and it should echo the anser " Get answer 4" but it always echo " Get answer 1". If i change the value of $gplus = 501, it still echo the answer "Get answer 1". What wrong am i doing?
  3. I was trying to get meta title, description,keywords in php but it works most of the website but not for codevdo.com and many others. <?php $get_tags = get_meta_tags("http://codevdo.com"); echo "this site has this description " . $get_tags['description'] . "."; echo "<br>"; echo "this site has these keywords " . $get_tags['keywords'] . "."; echo "<br>"; echo "<br>"; $url = 'http://codevdo.com'; preg_match("/<title>(.+)<\/title>/siU", file_get_contents($url), $matches); $title = $matches[1]; echo "this site has this title " . $title . "."; ?> This above code works good for most of site but it doesn't work for above site and many other. What code do i put a code that works for every website?
×
×
  • 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.