Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy php code to click/visit urls submitted from forms?

    Hi guys,

    Im a noob and I need some help.

    First of all, good to be here.

    I need help to create a simple php code that will click/visit all the urls I have entered on my forms. In other words, once I click submit button on my html form, it will then visit all the urls I entered earlier.

    Help and guidance needed. Thanksss

  • #2
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    How are you thinking of doing this?

    Will each url open up in a new tab/window or what?

    You may need to give a little more information of what it is you want the code to do, we know you want a form for someone to enter in url's but how many url's are allowed and what will happen after they submit them like I said about about tabs/windows?
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi DJCMBear,

    Thanks for replying. Sorry for the lack of info provided.

    the new pages will open on the same tab of that form. Just some small little pages will do. But which is easier? To open it on new windows is easier or to open all the pages on same tab as the form?

    Urls limitation, none.

  • #4
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    Well for one you cant open more than one url in a single tab/window unless you use frames on the page, now I would suggest something similar to this.

    NOTE: Untested!

    PHP Code:
    <?php # URL Opener - openURL.php
    /**
     * This script will open all url's in separate frames
     */
    function OpenURL($arr) {
      if(!empty(
    $arr)) {
        foreach(
    $arr As $url) {
          
    $frames[] = "<iframe src=\"{$url}\" class=\"URLFrame\"></iframe>";
        }
        return 
    implode("",$frames);
      }
    }

    $urls OpenURL(split(',',$_POST['urls']));

    print <<<FULLPAGE
    <style type="text/css">
    .URLFrame {
      display: block;
      width: 100%;
      height: 600px;
    }
    </style>
    <table>
      <tr>
        <td>HTTP Address's (<sup>Split with commas ','</sup>)</td>
        <td>
          <form method="post" action="">
            <input type="text" name="urls" />
            <input type="submit" value=" Open " />
          </form>
        </td>
      </tr>
      <tr>
        <td colspan="2">
    {$urls}</td>
      </tr>
    </table>
    FULLPAGE;
    ?>
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks! i will test it out.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •