How to convert a URL to Page Title?

9 replies
I have a .csv file in Open Office Calc that contains two columns:

the first column has the actual URL with http etc.

and the second column is the actual page title.

There are several hundred of these rows.

I would like to be able to convert the URL into each actual page title for use in an html page so that the URL doesn't actually show, just the title only that is clickable.

Any possible way to do this?

Thanks very much!
Charles
#convert #page #title #url
  • Profile picture of the author KirkMcD
    Yes. There are lots of ways of doing this. In which program/language do you want it done in?
    {{ DiscussionBoard.errors[5592521].message }}
    • Profile picture of the author realworldincome
      Originally Posted by KirkMcD View Post

      Yes. There are lots of ways of doing this. In which program/language do you want it done in?
      Thanks for responding KirkMcD!

      Perhaps I could use a php script on my webhost to convert from .csv format to HTML with the desired result? Not sure exactly which program or language would be needed.

      I did some searching on Google for a possible way to accomplish this but came up empty so far.

      Charles
      {{ DiscussionBoard.errors[5593128].message }}
  • Profile picture of the author K Meier
    Assuming your CSV looks like this:

    Code:
    URL | TITLE
    website1.com | Website 1
    website2.com | Website 2
    website3.com | Website 3
    I would do this quickly in PHP/MySQL.

    Upload the CSV into a mysql database.

    Write a php script which could look something like this:

    PHP Code:
     mysql_query("SELECT * FROM your_csv") or die (mysql_error());
    while( = 
    mysql_fetch_array())
    {
    echo 
    "<a href='".."'>".."</a><br />";

    EDIT:
    Sorry, can't seem to post the script properly, as it is always being escaped by the forum here.
    But the basic idea is just to do a while loop that reads out line by line of the mysql field.
    {{ DiscussionBoard.errors[5593253].message }}
    • Profile picture of the author realworldincome
      Originally Posted by K Meier View Post

      Assuming your CSV looks like this:

      Code:
      URL | TITLE
      website1.com | Website 1
      website2.com | Website 2
      website3.com | Website 3
      I would do this quickly in PHP/MySQL.

      Upload the CSV into a mysql database.

      Write a php script which could look something like this:

      PHP Code:
       mysql_query("SELECT * FROM your_csv") or die (mysql_error());
      while( = 
      mysql_fetch_array())
      {
      echo 
      "<a href='".."'>".."</a><br />";

      EDIT:
      Sorry, can't seem to post the script properly, as it is always being escaped by the forum here.
      But the basic idea is just to do a while loop that reads out line by line of the mysql field.
      Hi K Meier,

      That's exactly how the csv file reads. And this sounds like it could work.

      Since I am not a php wizard, would it be possible for you to attach that script to a post reply so I can download it and try it out? That would be really great.

      Either way, thanks for your reply.
      {{ DiscussionBoard.errors[5593450].message }}
  • Profile picture of the author K Meier
    If you upload a part of your CSV files here with the first 5-10 entries (or even replace your real entries with random ones) I could create something quickly.
    I'm only asking for the CSV files because depending on what program you used to create it, it does line separation differently, which is essential for the script.
    {{ DiscussionBoard.errors[5598475].message }}
    • Profile picture of the author realworldincome
      Originally Posted by K Meier View Post

      If you upload a part of your CSV files here with the first 5-10 entries (or even replace your real entries with random ones) I could create something quickly.
      I'm only asking for the CSV files because depending on what program you used to create it, it does line separation differently, which is essential for the script.
      That would great!

      Attached is an example .csv file created in OpenOffice Calc.

      Had to zip it - as attachment not allowed as a .csv file.

      Thank you.
      {{ DiscussionBoard.errors[5599605].message }}
  • Profile picture of the author jaredrasc
    yes it worked i have used this method to create list of websites

    Thanks man
    {{ DiscussionBoard.errors[5611614].message }}
  • Profile picture of the author stevemack
    this is really an interesting question and i wish to try ASAP and let me check the luck.
    {{ DiscussionBoard.errors[5618994].message }}
    • Profile picture of the author realworldincome
      So does anyone have the php code to do this?
      {{ DiscussionBoard.errors[5633751].message }}

Trending Topics