Jump to content

heeha

Members
  • Content Count

    43
  • Joined

  • Last visited

Community Reputation

1 Neutral

About heeha

  • Rank
    Member
  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?
  4. $a = array("bing", "google", "alexa", "microsoft") // this list is very big and putting it on same is not good. Is there is way, I can place this array list in another php files and call it on the form page?
  5. Thanks, I would surely see your example. This is good for learning. But Actually i needed what Barand said, I told that I want to show the information after the form has been processed. It mean's users already have the domain name with trademark names in them. They were there to check web data. During that time I wanted to show that information. Your's is good if i want to invite people to register a domain name, which I am not.
  6. This actually worked like a charm : <html> <body> <form method="get" action="test1.php"> Name <input type="name" name="url"> <input type="submit"> </form> <?php $url = $_GET['url']; echo $url; $a= array("google", "bing", "alexa"); if($url != str_replace($a,'',$url)){ echo "$url, you have violated this trademark."; } else { echo "result faild"; } ?> </body> </html> I tried another way: <html> <body> <form method="get" action="test1.php"> Name <input type="name" name="url"> <input type="submit"> </form> <?php $url = $_GET['url']; echo $url; if(strpos($url, 'google') !==false){ echo "this is working"; } else { echo "result failed"; } //this one also works but it actually takes one "value" not many." ?> </body> </html>
  7. Thanks for suggestion. I am learning php from w3schools and I will take a look at codeacademy also. I know basics about for and foreach and strings, and few others. I will try to implement what you said in post 4 and will see if it works.
  8. I have a website developed by other. In that users can check SEO data and some of them are people who has domain name carrying words of trademark companies. Like some people has mygoogle.com. So the form always gets processed and shows SEO data like Domain authority, social shares and alike. But I want to show users another message that your domain name also contains trademark names in it and you shouldn't use such domain names. As i am not a developer so i don't know how to achieve that. I don't want my developer to do it because i want to learn myself and show the information. All i was trying to do is that I want to create a another file carrying the list of Trademark companies and when users process a domain name that has trademark names inside them, I want to print that message for them along with the SEO data processed.
  9. No, may be I wasn't able to put it the way I want to. Let me try it again. When user enters a name say "Metina", and "tina" name is already in the list. So I want to make that form still get processed but I want to show the user that your name contains word "tina" in it. We don't allow tina words therefore, we already have that word. Like, a user has "mygoogle" in his website name and i want to place a tag, that your name has "google" and we don't allow you to use that because google is others property.
  10. Hi, I am new to php and still learning. I have been not able to work for few months due to work but Now again trying to learn. I have a php form : <form method="post" action="test.php"> Name=<input type="text" name="yourname"> submit<input type="submit"> </form> I have a file called test1.php. It has many names Lets say : Ron, ronda, carl, mathew, alexa,tina, lima, soniya, viktoria. List is big but lets count to this much. Now i want that if a user puts a name form as "iviktoriana" . I want to remove this extra"i" and "na" words after form processing. I don't want to remove it while processing the form. How do i use make it work?Do i need to put these names in array in test1.php
  11. Thanks. There are few variable to check for as i m looking to get output via $dnsinfo, so I think that $dnsinfo should be placed here. But I was getting the same error. Then i tried every php variable used on coding, $host, $result, but result always shows said above error.
  12. $u992092914_trial : this is actually a database name. i used it to check if database exists/ is set or not. Am i doing it wrong?
  13. Regarding TRUE and true, which i actually did to see if anything wrong goes with the both or both are considered same. It was not like copy/paste, if it was, you would have seen more perfection or error free coding than you are seeing. Errors are so much because I m at learning phase. I checked and removed the TRUE from it ...[ if($myconn->query($user_query ===TRUE)) but i m still seeing this error I have also changed the name of columns and values and also checked if anyone of them is reserved word or not and Used only 3 columns and 3 values for that to insert data in databases but no success Warning: mysqli::query(): Empty query ... I guess the reason might be that only "url" is considered from the form to be inserted into the tables but not the dns records which i am outputting via php coding from the form itself and is trying to add insert into databases.
  14. I have added "values" by putting dns records as variables in values but now i m seeing that if(isset($u992092914_trial))// check the db exists { $host= $dnsinfo['host']; $class = $dnsinfo['class']; $ttl= $dnsinfo['ttl']; $type= $dnsinfo['type']; $pri = $dnsinfo['pri']; $target= $dnsinfo['target']; $user_query= "INSERT INTO u992092914_trial( host, class, ttl, type, ip address, rname, mname, refresh, retry, expire, min ttl, txt), VALUES('$target', '$class', '$ttl', '$type', '$pri', '$target')"; } if($myconn->query($user_query ===true)){ echo "Tables created successfully"; } else { echo "tables cant be created." .$myconn->error; } $myconn->close(); ?> Warning: mysqli::query(): Empty query in /home/u992092914/public_html/b/mysql.php on line 79 tables cant be created. I added example.com in the form and it processed it well dns record for it perfectly but it tables are not getting created.
  15. I will the best i can but i dont want to put excessive coding on my script because i wouldn't remember all at once. All i will be doing is to take or put code that are only necessary and only those i can remember and learn[that's the motive]. If i put all the coding of php like exception handling, error handling, session_start() or header() or anything like that all at once i might end up having so much in my brain that i may be not be able to grasp what i was doing and for what. I do understand that the coding i am doing is not well formed and organised but I would keep developing a habit to improve it with time.
×
×
  • 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.