SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    capture source code when i give URL

    Hi,

    When i submit the URL then it displays page source code.plz give suggestions for that and how to start.

    Like view->Page Source

  2. #2
    SitePoint Zealot loathsome's Avatar
    Join Date
    Jul 2008
    Location
    Norway
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You want to do what, fetch the source code of a page? If so, that's as simple as

    Code PHP:
    $url = 'http://sitepoint.com';
    echo file_get_contents($url);
    Time you enjoy wasting is not wasted time.

    Loathsome Systems

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2008
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "$url = 'http://sitepoint.com';
    echo file_get_contents($url);"


    we used like that way index page displayed.My requirement is to display the source code of that page.For that plz help

  4. #4
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by swethak View Post
    "$url = 'http://sitepoint.com';
    echo file_get_contents($url);"


    we used like that way index page displayed.My requirement is to display the source code of that page.For that plz help
    PHP Code:
    $url 'http://sitepoint.com';
    // Escape the HTML tags so they don't get parsed as HTML.
    echo htmlspecialchars(file_get_contents($url)); 
    You need to escape the HTML characters (change < in &lt;, etc), otherwise you are printing HTML that will parsed.

  5. #5
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    header("Content-type: text/plain");
    $url "http://www.yahoo.com"
    echo 
    file_get_contents($url); 
    my mobile portal
    ghiris.ro


Bookmarks

Posting Permissions

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