file_get_content problem
Posted by: miiikkeyyyy (---.leed.adsl.virgin.net)
Date: April 16, 2008 11:40PM

i've always used wampserver, ive never had this problem.
at the moment im currently testing scripts out.

i wrote this simple one, just to connect to google..
but it doesn't work.
i uploaded to a webserver, and it works fine.

Script Begin.
------------------
<?php
//-----------------------------------------------------------------
// Connect To Site
//-----------------------------------------------------------------

$url = "[google.com];;
$connect= @file_get_contents($url) or die('Could not access file: '.$url.'');
?>
------------------
Script Ends.


A bit of server info
-------------------
My PHP Version is: 5.2.5
My Apache Version is: 2.2.8
My WAMP Version is: WampServer 2.0 - default settings.

Thank you in advance,
Mikey

Options: ReplyQuote
Re: file_get_content problem
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: April 17, 2008 05:26AM

php5.2cant do this. use curl

Options: ReplyQuote
Re: file_get_content problem
Posted by: toivo (---.nsw.bigpond.net.au)
Date: April 17, 2008 10:20AM

Hi,

That should work all right , it works all right in my identical configuration, both from the browser and from the command line.

Add the following to the end of the script:

echo $connect;

Call the script [localhost] and you should see the contents of the page minus images.

Maybe not related, but is your WAMP server behind the protective layers of proxy and corporate firewall? I tried to get getimagesize() working in such an environment but had to give up.

Regards,

toivo
Sydney, Australia



Edited 1 time(s). Last edit at 04/17/2008 10:26AM by toivo.

Options: ReplyQuote
Re: file_get_content problem
Posted by: miiikkeyyyy (---.leed.adsl.virgin.net)
Date: April 17, 2008 01:13PM

Thank you stevemarting99,
I looked up cURL and that works fine :]

I hadn't even heard of it.

Options: ReplyQuote
Re: file_get_content problem
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: April 17, 2008 01:24PM

no problem,

Your Welcome

Options: ReplyQuote


Sorry, only registered users may post in this forum.