Web Hosting Talk







View Full Version : PHP scripts


Totalise-Matt
11-06-2000, 03:13 PM
Apologies for what may be a fairly basic question, I'm quite new to all this!

I am trying to capture web content from other sites onto mine using PHP script. When I upload the page to my host, the grab doesn't seem to work. Does your host specifically need to support these kind of scripts in order to work or should it work with any host that is able to upload HTML sucessfully.

Also, does PHP script sit in the HTML code of the page you are trying to design.

Many thanks for any comments,

Matt

KDAWebServices
11-06-2000, 03:39 PM
If you would like to post your script I'm sure I can help you out. Your host shouldn't need to enable such scripts although I do believe it is possible to stop fopen() (I assume you are using fopen()? ) from opening URLs, but you can get round it by using fsockopen().

Greg
11-06-2000, 03:45 PM
Originally posted by Matt
Does your host specifically need to support these kind of scripts in order to work or should it work with any host that is able to upload HTML sucessfully.



Yes, your host must have PHP installed on their server before it will work.

Totalise-Matt
11-06-2000, 04:18 PM
Thanks for your replies, the script I am using is the following which indeed has fopen() in it:

$file=fopen("url","r");
$rf=fread($file,20000);
$grab=eregi("start(.*)end",$rf,$printing);

Thanks in advance for any help you can give. I have tried using fsockopen() but that hasn't worked.

Matt

alchiba
11-06-2000, 04:23 PM
Originally posted by Matt
Also, does PHP script sit in the HTML code of the page you are trying to design.

PHP code is embedded within your page's HTML code, but the page must have a .php or .php3 extension. (.php for PHP version 4 and .php3 for version 3 is the convention.)

Dreamweaver, FrontPage, and simliar tools tend to screw up everything when you save pages with PHP code in them. There are workarounds by surrounding the PHP code with special tags. I think there was a discussion of that here, which you could search for.

Try dropping this code into a page and see if it works:

<?
$fp = fsockopen ("www.yahoo.com", 80, &$errno, &$errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>


[Edited by alchiba on 11-06-2000 at 03:35 PM]

Totalise-Matt
11-06-2000, 05:12 PM
Thanks Ed,
I tried the code but again with no success.
I think it must be my host as mentioned above which doesn't support PHP.
Matt

Greg
11-06-2000, 05:39 PM
Who is your host? Most hosts have a list somewhere on their site of what is installed on their servers, have you checked out their site?

Totalise-Matt
11-06-2000, 06:34 PM
Greg,
The host I'm using at the moment is uk2.net which supplies lots of very cheap products and services and as such I think you do get the bare minimum when you buy (e.g. webspace). I tried to look to see if it had software that would support PHP script but because it is not specifically mentioned and there is not really a list as such and not knowing too much about the whole thing, I assume it probably hasn't.

The site does quote this however which may mean something to you...

"We are the biggest host in the world using exclusively Linux for hosting. We do no longer provide any NT hosting facilities at all."

Matt

KDAWebServices
11-06-2000, 06:59 PM
Matt if you desperately want to use PHP to the job then drop me a line.

Acroplex
01-02-2003, 11:18 PM
All this wisdom was buried for too long.

Rich2k
01-03-2003, 05:45 AM
Of course you do have permission to use the content of that web site on your own don't you ;)

If not they may get VERY upset

Actually this is exactly the sort of thing which makes XML such a useful thing.

Just take an XML feed from moreover, for example, cache it and then transform it in PHP. I have a PHP / XML / XSLT class which can be done by including one file and then running two lines of code (of course you have to write the XSLT yourself).

mistral1
01-03-2003, 05:00 PM
Originally posted by Matt

The host I'm using at the moment is uk2.net which supplies lots of very cheap products and services and as such I think you do get the bare minimum when you buy (e.g. webspace). I can't see how £50 (~$80 pa) for hosting is cheap with no frills and no PHP?

They advertise domain names for 0.01 pence then they come up with a bill for £10 for a .uk name? And if you want to transfer it elsewhere you have to pay an additional £19 transfer-out surcharge on top.

I know this isn't the right place to talk about domains and such, but I couldn't resist commenting. ;)

MDJ2000
01-03-2003, 06:20 PM
Guys, the post is over 2 years old, timechange was just being a dillweed digging it up. 2+ years ago, PHP actually wasn't as commonly installed as you may think.