Freelancer

Random links html output  

Random links html output is project number 339050
posted at Freelancer.com. Click here to post your own project.


| More Free Trial For New Buyers
 

Status:

Selected Providers: UmidKZ

Budget: $30-250

Created: 11/05/2008 at 6:40 EST

Bid Count: 9

Average Bid:
N/A

11/07/2008 at 6:40 EST

Project Creator: smds
Employer Rating: 10/1010/1010/1010/1010/1010/1010/1010/1010/1010/10 (4 reviews)

Bid On This Project
 

Description

This is a very small and simple PHP job and should be very quick and easy for anyone with decent php experience.

I am wanting a php function that can be called from any webpage on any domain. The function will retrieve and return a list of urls and anchor text.

The calling webpage will pass the following paramater3:

1) The name of a text file, for example ?f="list1.txt"
2) The number of links to retrieve. If left blank default to 4
3) A 'separation' string (which may be blank, in which case default to   as the separator) that will separate the various links, for example:
" | "


The function will

1) Retrieve the named text file from a directory - the directory should be specified as a constant in the function itself so I can change it later if I wish to. A full filepath may be used, or a relative url.
2) Return a string consisting of the (randomly selected) specified number of links. In the text file each link url and anchor text will be on a separate line like this:

<a href="http://example.com">Anchor text</a>
<a href="http://anotherexample.com">Different text</a>

The links should be chosen randomly from the lines in the list (which could contain thousands of lines). Each link should be separated from the next one using the 'separation' parameter passed from the calling program.

If there is only 1 link returned there is no need for the separation text to be added. There should be no separation text after the final link.

For this example separation text the string returned to the calling program should therefore look something like this:

<a href="http://example.com">Anchor text</a>&nbsp;|&nbsp;<a href="http://anotherexample.com">Different text</a>

Finally, the function should simply return nothing if invalid input is passed to it, or if the text file does not exist.

I've given a very detailed description because the right person will see that this is a well specced simple job and should be able to do it very quickly.

If there are any questions please let me know.

Messages Posted:0 View project clarification board Post message on project clarification board

Bid On This Project
 

If you are the project creator or one of the bidders Log In for more options

Bids are hidden by the project creator. Log in as the project creator or as one of the bidders to view bids. You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


    Bid on this Project