Form Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Form Issue

Post by Vegan »

Seems to be some problem with my form, seems that nothing is being sent to the browser

Code: Select all

<?php
if(isset($_POST['user_url'])) {
 
    $user_url = $_POST['user_url'];
    $sitemap = "/sitemap.xml";
    
    $API = array(
        "webmaster.live.com/webmaster/ping.aspx?siteMap=",
        "search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&url=",
        "www.google.com/webmasters/tools/ping?sitemap=",
        "submissions.ask.com/ping?sitemap=",
        "api.moreover.com/ping?sitemap=",
        "www.bing.com/webmaster/ping.aspx?sitemap=",
    );
    
    foreach ($API as $api_url) {
        $arg  = "http://";
        $arg .= $api_url;
        $arg .= "http://";
        $arg .= $user_url;
        $arg .= $sitemap;
 
        echo $arg . "\n";   
        readfile($arg);
        flush();
        sleep(10); // 10 seconds, so servers do not balk
    };
} else {
    echo '<form method="post" action="http://www.contract-developer.tk/services/submit.php">'
        .'URL <input type="text" name="user_url"> <input type="submit" name="submit" value="Submit">'
        .'</form>';
}?>
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Form Issue

Post by superdezign »

Hmm. Not exactly sure what the problem is. Maybe you should try file_get_contents() instead of readfile() and see if you get results.
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Form Issue

Post by Vegan »

No joy

Seems to not want to display anything, does not make sense.
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Jsphlane20
Forum Newbie
Posts: 17
Joined: Wed Aug 11, 2010 1:17 pm
Contact:

Re: Form Issue

Post by Jsphlane20 »

The form seems to be fine. Try commenting out the sleep satement and also replacing the $arg variable with a hard coded site that has downloadable content. Report back with results. The problem may potentially be in the below area.

Code: Select all

        //echo $arg . "\n";   
        readfile('Place website here');
        flush();
        //sleep(10); // 10 seconds, so servers do not balk
 
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Form Issue

Post by Vegan »

I have to use the string processing to generate the list of URLs I am submitting to.

I will try the sleep and see how that helps.
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Form Issue

Post by Vegan »

I was wondering, is there another way after the PHP code is done to return to the original page ready to accept another URL?
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Post Reply