Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    I don't know if I am posting this in the right category or not. If I have a page on mysite.com and need to read a page title from another page on another site, how do I do that?

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Using php, you can do this:
    PHP Code:
    <?php

    $html 
    file_get_contents("http://www.theirsite.com/page.html");

    $start strpos($html"<title>") + 7;
    $end strpos($html"</title>");

    if (
    $start && $end)
      
    $title substr($html$start$end-$start);
    else
      
    $title "Not found";

    ?>

  4. #3
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    That is awesome. That helps a lot with an page I'm creating for advertising an affiliate.

    Thanks!

  5. #4
    WDF Staff m3n0tu18's Avatar
    Join Date
    Jul 2011
    Location
    Devon, UK
    Posts
    1,473
    Member #
    28473
    Liked
    265 times
    Moved thread to correct forum. -m3
    If you like my comments to your thread please click the LIKE button

    Check out my portfolio: Here!
    View my company Facebook Page
    View my company Website

    <<Plrease ignoer my typo's I have isdexlyia>>

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Glenn,
    If your webhost doesn't allow file_get_contents for external URL's,
    you'll have to use PHP CURL. Let us know if things go awry.


  7. #6
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    It is working great. I'm now using this info to get the price to display. I have run into a snag. I am using what you gave me to find "Price:" and what follows is the price. Could be "$21.95" or "$38.49 - $49.89" or other variations. The problem I am having is, the price always ends with </span>. Would not be a problem but there could be 20+ "</span>" tags. So, how do I tell it to find the very next </span> tag?

  8. #7
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    $start = strpos($html, "Price: ") + 7;
    $end = strpos($html, "</span>", $start);

    The third parameter tells it to start searching at the $start position and return the first match after that point..

  9. #8
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    Thanks. This is working out great!


Remove Ads

Posting Permissions

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

Search tags for this page

webpage read title of another page

Click on a term to search for related topics.
All times are GMT -6. The time now is 04:59 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com