# Solved: Availability script



## giovannicosta (Aug 24, 2006)

I need a script that will display the table that says in stock/not in stock from this website (http://uk.nowinstock.net/wii/index.php) any ideas?

BTW, the table is updated every few minutes

i need it to be able to work in frontpage


----------



## brendandonhu (Jul 8, 2002)

They already have a RSS feed
http://uk.nowinstock.net/wii.xml


----------



## giovannicosta (Aug 24, 2006)

hiw can I add the rss feed to be displayed on my website then?


----------



## brendandonhu (Jul 8, 2002)

In what language? And what exactly are you trying to get it to say?


----------



## Eriksrocks (Aug 7, 2005)

You could use an iframe (messy) or you could write a PHP script to retrieve the page and edit out everything but the table (much less messy but harder).


----------



## Eriksrocks (Aug 7, 2005)

For a PHP script:
http://php.about.com/od/advancedphp/ss/php_read_file.htm

Get the file, open it with fopen() then just search the string for a certain part where the table starts, only get that part until the table ends.

http://www.php.net/manual/en/function.stripos.php

Of course there is a legality aspect of it. Make sure you credit the site. Asking permission would be good too.


----------



## namenotfound (Apr 30, 2005)

giovannicosta said:


> hiw can I add the rss feed to be displayed on my website then?


You mean something similar to this?

You can try this script


----------



## giovannicosta (Aug 24, 2006)

I know but I want to add them to my website, could someone write me up something I can insert into frontpage for that table to appear if you could


----------



## namenotfound (Apr 30, 2005)

Erm... the script I linked to will do that for you, it requires PHP.
The script will put the RSS feed on your site for you. You can customize the script so the feed displays how you want it to display


----------



## brendandonhu (Jul 8, 2002)

```
<?php
if(strstr(file_get_contents('http://uk.nowinstock.net/wii.xml'), 'Sorry None in Stock'))
{
  echo 'Not available';
}
else
{
  echo 'Available';
}
?>
```


----------



## giovannicosta (Aug 24, 2006)

READ PM I SENT YOU brendandonhu


----------



## brendandonhu (Jul 8, 2002)

There's a forum here, you don't need to PM people your posts.

Do you have PHP installed?


----------



## giovannicosta (Aug 24, 2006)

In frontpage? Dunno, how do I install it?


----------



## namenotfound (Apr 30, 2005)

No, he means on the sever, not frontpage 

He's asking if you have PHP installed on the server


----------



## giovannicosta (Aug 24, 2006)

I dunno, my host is xenweb, I think so.


----------



## giovannicosta (Aug 24, 2006)

Yeah they do, any ideas


----------



## brendandonhu (Jul 8, 2002)

You have to tell us what the problem is exactly.


----------



## giovannicosta (Aug 24, 2006)

Have a look @ http://www.giovanni.xenweb.net/Is the wii in stock.htm
nothing after teh words current status


----------



## namenotfound (Apr 30, 2005)

giovannicosta said:


> Have a look @ http://www.giovanni.xenweb.net/Is the wii in stock.htm
> nothing after teh words current status


How do you expect a .htm file to parse PHP? 

Change the file extension to .php


----------



## namenotfound (Apr 30, 2005)

OR if you want, you can put this in a .htaccess file

AddType application/x-httpd-php .htm


----------



## giovannicosta (Aug 24, 2006)

OK i have this error @ http://www.giovanni.xenweb.net/Is the wii in stock.php

"Parse error: syntax error, unexpected '<' in /home/giovanni/public_html/Is the wii in stock.php on line 113"


----------



## namenotfound (Apr 30, 2005)

Post the code for that page, doesn't have to be the whole thing, just the first 5 lines before and after 113, including line 113 itself


----------



## giovannicosta (Aug 24, 2006)

Ok working how can I make it say: Currently the wii is, and then that code as I dont knwo php


----------



## namenotfound (Apr 30, 2005)

If you're using brendon's code then where it says "echo" add it there. In other words:


```
<?php
if(strstr(file_get_contents('http://uk.nowinstock.net/wii.xml'), 'Sorry None in Stock'))
{
  echo 'Currently the Wii is: Not available';
}
else
{
  echo 'Currently the Wii is: Available';
}
?>
```


----------



## giovannicosta (Aug 24, 2006)

Thankyou to all problem SOLVED


----------



## namenotfound (Apr 30, 2005)

You're welcome


----------



## giovannicosta (Aug 24, 2006)

I gave you a thanks at xenweb.


----------

