We help IT Professionals succeed at work.

Creating a Site Submit Script

Medium Priority
262 Views
Last Modified: 2013-12-08
Hi,

I am just wondering, I am thinking of creating a Site Search Submit Script. In other words something where people including myself can go to my website and type in their URL and have it submit it to a list of predefined search engines. Does anyone know if this can be done and how hard is it to do.

Kind Regards,
CompTeck2255
Comment
Watch Question

It is not hard at all. You need to know URL which does to work. For example:

http://www.coolsearchengine.com?site_to_add=Your_site

To automatically submit to this site in PHP, you may do:

file_content("http://www.coolsearchengine.com?site_to_add=".$_POST["user_entered_url"]);

That's it. Posting data via POST is a little harder but still easy (see CURL library)

Author

Commented:
Hi, BarsMonster

Thanks for the quick reply. This is great information how would I get this onto my server to display it to the end user.

Kind Regards,
CompTeck2255
Here is the mockup. Anyway, you should know PHP to customize it and make it work in your environment.

<h1>Submit your site to all known search engines</h1>
<form method="post" action="">
<input type="text" name="user_entered_url">
<input type="Submit">
</form>
<?
  if(isset($_POST["user_entered_url"]))
  {
   file_content("http://www.coolsearchengine.com?site_to_add=".$_POST["user_entered_url"]);
header("Location: /site_submitted.php");
exit;
}
?>

Author

Commented:
Ok greats thanks, Now that will submit the website that they enter in to the Search Engines that I input correct? If so how can I add more to it.

Thanks :)
You need to figure out submission urls and duplicate this line with different submission urls:

 file_content("http://www.coolsearchengine.com?site_to_add=".$_POST["user_entered_url"]);

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Great, Thanks for you help on this matter, I shall get back to you if I have any issues.

Author

Commented:
Hi,

I seem to be getting this error when I enter in a url like http://site.com.au 

Fatal error: Call to undefined function file_content() in /home/eva50119/public_html/new 2.php on line 16

Any ideas
Sorry, correct name is file_get_content :-)

Author

Commented:
Hi

This is the code that I have so far. But I am still getting this error
Fatal error: Call to undefined function file_get_content() in /home/eva50119/public_html/new 2.php on line 16

Do you know what is causing this. Will this work as Google and the other ones that I hope to use all use CAPTURA Verification before you can submit it.

Kind Regards,
CompTeck2255


<h1>Submit your site to all known search engines</h1>
<form method="post" action="">
<input type="text" name="user_entered_url">
<input type="Submit">
</form>
<?
 if(isset($_POST["user_entered_url"]))
 {
file_get_content("http://www.google.com/addurl/?continue=/addurl".$_POST["user_entered_url"]);
header("Location: /site_submitted.php");
exit;
}
?>

Open in new window

Author

Commented:
Sorry above there is no line 16 that is because I had some other customizations to it in there the file has now been reuploaded without the modifications now here is the new line.

Fatal error: Call to undefined function file_get_content() in /home/eva50119/public_html/new 2.php on line 9
Try latest PHP, probably yours is older than 4.3 or url_fopen is restricted (many shared hosting companies restrict external calls).

For captcha - check recaptcha.com, also you may find examples of integrating captcha in google, they are not that small to write here :-)

Author

Commented:
Hi,

Thanks for the help. It was much appreciated :)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.