Jump to content

chupacabrot

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by chupacabrot

  1. im having a simple html form that gets variables via 'POST' and passes them to simple.php, the simple.php file constructs a new link with the $_POST[] - and all i want to do is creating a simple iframe (this script is only for internal uses) underneath the form that will open the new link that was created within simple.php

     

    to clarify it a bit more

     

    here's form.html

     

    <form name="Students Management" action="http://myowntest.com/simple.php" method="post" accept-charset="utf-8">
    
    <p>
    <label>First Name</label>
    <input type="text" value="" name="firstname"  ></input>
    </p>
    <p>
    <label>Phone</label>
    <input type="text" value="" name="phone"  ></input>
    </p>
    <p>
    <label>Last Name</label>
    <input type="text" value="" name="lastname"  required="true"></input>
    </p>
    <p>
    <label>Company</label>
    <input type="text" value="" name="school"  required="true"></input>
    </p>
    <p>
    <label>Email</label>
    <input type="text" value="" name="email"  ></input>
    </p>
    <p>
    <label>Country</label>
    <input type="text" value="" name="age"  ></input>
    </p>
    <p>
    <input type="submit" value="Submit" ></input>
    </p>
    </form>

    and here's simple.php

    <?php
    
    $newUrl = 'http://www.myothertestspace.com/simlpe2.php?name=' . $_POST['name'] . '&surname=' . $_POST['lastname'] . '&phone=' . $_POST['phone'];
    header(Location: $newUrl);
    
    ?>

    now, all i want is - after the user 'submits' the details on form.html , i'd like a new iframe will be shown up in the same page as the form that will show the user the contents of

    simple.php (which means - myothertestspace.com with the new parameters).

     

    thanks a lot!

  2. Is there any reason why my questions aren't being answered? Am I rephrasing them wrong or something?... At least give me some further notes so i'll get a bit more effective in this forum.. I don't really find it as a hard question - And i haven't found an answer anywhere online so it could be great of you guys to at least tell me why i'm being ignored...

  3. " Each value there is a simple html snippet like '<a href=http://www.mywebsite.com/tes2t>testing</a>' ." 

     

    Means that 

    $arrinfo[0] = '<a href=http://www.mywebsite.com/' . $test2[0] .'>this is value . $test[0] .'</a>'
    $arrinfo[1] = '<a href=http://www.mywebsite.com/' . $test2[1] .'>this is value . $test[1] .'</a>'
    $arrinfo[2] = '<a href=http://www.mywebsite.com/' . $test2[2] .'>this is value . $test[2] .'</a>'
    $arrinfo[3] = '<a href=http://www.mywebsite.com/' . $test2[3] .'>this is value . $test[3] .'</a>'

    and so on..

  4. I realized that my previous question wasn't clear enough so i decided to open a new thread (hopefully the old one will be removed - sorry for inconvinience).

     

    Here's my question - I got an extern html form that passes a value to some php file that is called makelist.php - The makelist.php simply analyzes the data that was sent through the $_POST method and puts all the 'right' values in one string array that is called $arrinfo - Each value there is a simple html snippet like '<a href=http://www.mywebsite.com/tes2t>testing</a>' .

     

    Now, assuming that i  have an existing wordpress page which is called 'test1' for example - How can i put -all- that links (snippets) that exist in $arrinfo into a new sub page which will be like www.mywebsite.com/test1/arrinfolinks/ ?

     

    Do i need to install any wordpress plugin that will allow me to insert PHP code within posts/pages? Or is there any way to do it externally out of my php code? I can definitely put my php files in the same directory that wordpress uses so i can use wp_insert_post() for example - but i just couldn't figure yet how to create a sub page and insert all $arrinfo's content into it so it will be shown as links and not plain text of html tags..

     

    thanks in advance..

  5. Assume that $bandList is an array of strings , and i want to create a page with the whole list - 

     

    function createWPpage($bandlist)
    {
    $link = mysql_connect("localhost","root","pass","wordpress");
    if(!link) { die('Could not connect: ' . mysql_error());
    }
    
    
    $sql = 'INSERT INTO wp_posts '.
    '(post_content,post_title,post_type) '.
    'VALUES {'$bandlist','List of Bands','page'}';
    
    
      mysql_select_db('wordpress');
    $retval = mysql_query( $sql, $conn );
    if(! $retval )
    {
       die('Could not enter data: ' . mysql_error());
    }
    echo "Entered data successfully\n";
    mysql_close($conn);
    
    
    } 

    Well, I got wordpress installed on localhost but for some reason it wont show any error or warning while trying to execute this code (turned E_ALL on) but on the other hand - it doesn't make any changes to the actual database.. am I missing something?

  6. I mean, every 'submit' button will respectively send a $_POST request to some other .php file that connects to a specific database of the desired wordpress and will use wp_insert_post there with the data that sent over the POST method?

  7. Conceptually i'm stuck (:

    I know i can insert post with wp_insert_post when im already in this blog  - but how can i make it remotely? do i actually need to open multiple mysql connection to each wordpress database and then insert the posts?

  8. i am trying to extract all the anchor texts that have the _blank attribute but for some reason it won't work as i expected (shows a blank screen) -

    <?php
    
    require('simple_html_dom.php');
    libxml_use_internal_errors( true);
    $url = 'http://www.siteforexample.com/example.html';
    
    $html = file_get_html($url);
    
    foreach(($html->find('a[_blank]')) as $clz)  echo $clz->innertext . '<br>';
    
    ?>
  9. Hello, Is there any way to -remotely- insert a post to a custom wordpress URL? Assuming I have a network of 5 websites and i would like to update all of them through some form i'll build (may say - a mini CMS maybe).

     

     

    Site 1 -

    [Form for content] [submit button]

     

     

    Site 2 -

    [Form2 for content] [[submit button]]

     

     

    Site 3 -

    [Form3 for content] [submit button]

     

    ... and so on.

     

    And simply everytime i'll pust the submit button the Form3 content will go to a specific wordpress website, and same about Form2 and Form1. Thanks.

  10. well.. unfortunately it still doesn't work.. :\

    <?php
    $url = 'http://www.mywebsiteforexample.com/categories.html';
    $contents = file_get_contents($url);
    libxml_use_internal_errors( true);
    $doc = new DOMDocument;
    $doc->loadHTML( $contents);
    $xpath = new DOMXpath( $doc);
    
    
    $categorylinks = $xpath->query('//div[@id="categories en"]/a'); //please notice the space in the div's name - maybe that causes any trouble
    
    // loop through the links and echo the link text
    foreach($categorylinks as $link)
    {
        echo $link->textContent .'<br />';
    }
    
    ?>
  11. Assuming that http://www.mywebsiteforexample.com/categories.html has a div called 'categories en', here's what i tried and for some reason it still doesn't work

    <?php
    $url = 'http://www.mywebsiteforexample.com/categories.html';
    libxml_use_internal_errors( true);
    $doc = new DOMDocument;
    $doc->loadHTML( $url);
    $xpath = new DOMXpath( $doc);
    
    
    $categorylinks = $xpath->query('//div[@id="categories en"]/a'); //please notice the space in the div's name - maybe that causes any trouble
    
    // loop through the links and echo the link text
    foreach($categorylinks as $link)
    {
        echo $link->textContent .'<br />';
    }
    
    ?>
  12. I'm quite new to regular expressions and i looked through all the asked questions and unfortunately couldn't find any answer.. I want to extract a specific parts of my website and simply echo them to a new page. My list of categories is structured alphabeticlly like this -

    <a href="architecture.html">ARCHITECTURE</a><br />
    <a href="art.html">ART</a><br />
    <a href="avantgarde.html">AVANTGARDE</a><br />

    . . . and so on.

    now, what i'm trying to actually do is to extract all the categories as a plain text and simply echo them on the screen. (in this case i need to extract every string that starts with ">A and ends with </a (assuming i dont have any other similiar pattern within my code).

    i found this piece of code actualy in stackoverflow that supposed to extract anything that exists between tags, but unfortunately it's not the case..

    html part -

    <div name="changeable_text">**GET THIS TEXT**</div>

    php part -

    $categories = file_get_contents( $url);

    libxml_use_internal_errors( true);
    $doc = new DOMDocument;
    $doc->loadHTML( $categories);
    $xpath = new DOMXpath( $doc);

    $node = $xpath->query( '//div[@name=changeable_text]')->item( 0);

    echo $node->textContent; // This will print **GET THIS TEXT**

×
×
  • 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.