在ajax调用中处理php代码

I am using ajax on a website that calls a php script that then parses another page and returns the part of the page that I want to display. I have used this technique in the past and it works well, except this time the part of the page that is being returned has some php code in it and it is being returned raw with out the php code being processed.

Here is the php script that is doing the parseing and returning the results.

require_once('simple_html_dom.php');
$dom = new simple_html_dom;

if(isset($_GET['url']))  {
    $url = $_GET['url'];
    $html = file_get_html($url);
    /*get contents*/
    $contents = $html->getElementById('content');
    echo $contents;
}

As I mentioned what is being returned in $contents is being returned raw with out the php code inside the $contents string being processed, how can I get it to process the php code before returning the $contents string?

Thank you in advance for your help.

查看全部
dongtuanzi1080
dongtuanzi1080
2012/12/30 05:26
  • php
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复