www.webdeveloper.com
Results 1 to 5 of 5

Thread: Why?include wp-load with simple_html_dom have conflict.

  1. #1
    Join Date
    Jul 2011
    Posts
    3

    Why?include wp-load with simple_html_dom have conflict.

    Why is this 'include('wp-load.php')' with 'include('simple_html_dom.php')' will have a conflict???

    include 'wp-load.php' for run function wp_insert_post($post) ,
    but once include 'wp-load.php' ,the parse function can not to run that in 'simple_html_dom.php'.

    can any one to help me? thanks a lot.

    <?php
    //include('wp-load.php'); //include 'wp-load.php' for run function wp_insert_post($post)
    include('simple_html_dom.php');

    $post = array();
    $post['post_status'] = 'publish';
    $post['post_author'] = 1;
    $post['comment_status'] = 'closed';
    $post['post_title'] = '';
    $post['post_content'] = '';
    $post['post_date'] = date('Y-m-d H:i:s',strtotime("now"));

    $parseURL = 'http://www.tradebit.com/visit.php/71080/product/-/87837706';
    $html = new simple_html_dom();
    $html->load_file($parseURL);
    $title = $html->find("title", 0);
    $title = explode(" - ", $title->plaintext);
    $post['post_title'] = $title[0];
    $post['post_content'] = $html->find('div[class=orangeContent]',1);

    echo '$post post_content ' . $post['post_content'] . '<br>';
    echo 'title' . '<br>';
    echo $post['post_title'] . '<br>';

    wp_insert_post($post);

    $html->clear();
    unset($html);

    ?>

  2. #2
    Join Date
    May 2011
    Location
    With Hobbits
    Posts
    125
    First of all please post php in php tags so its more readable
    with like
    [.php]
    [./php]
    without the .'s

    And please post the error you are getting along with those 2 scripts that are conflicting.

  3. #3
    Join Date
    Jul 2011
    Posts
    3

    wp-load with simple_html_dom have a conflict

    hi, thanks your reply.
    when i disable include wp-load , it throw below error.
    Fatal error: Call to undefined function wp_insert_post() in C:\wamp\www\testinclude.php on line 26
    for function wp_insert_post() need include wp-load.

    when i include wp-load the simple-html-dom cannot work.
    it throw below error.
    Fatal error: Call to a member function find() on a non-object in C:\wamp\www\simple_html_dom.php on line 879

    wp-load with simple_html_dom have a conflict.

    can anyone give a hand? thank a lot.

  4. #4
    Join Date
    May 2011
    Location
    With Hobbits
    Posts
    125
    Here is a website talking about it

    here

  5. #5
    Join Date
    Jul 2011
    Posts
    3
    this program think parse website then auto post to wordpress blog.
    so it need include wpload.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles