Forum Moderators: coopster

Message Too Old, No Replies

Hi, Script is not working anybody can help me

         

MrKool

4:22 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



Hi,

This script is not working. Anybody can help me.
Please check it or upload it for just testing on your server and find the solution for it.

Looking for positive answer

<?php

$GrabURL = "http://weather.cnn.com/weather/forecast.jsp?locCode=NYC";

$GrabStart = "<!-- 5day forecast -->";
$GrabEnd = "<!-- /5day forecast -->";

$OpenFile = fopen("$GrabURL", "r"); //- DO NOT CHANGE
$RetrieveFile = fread($OpenFile, 200000); //- Reduce This To Save Memory
$GrabData = eregi("$GrabStart(.*)$GrabEnd", $RetrieveFile, $DataPrint);
// $DataPrint[1] = str_replace("", "", $DataPrint[1]); //- Un-Comment This Line for "Replace" purposes!
// $DataPrint[1] = str_replace("", "", $DataPrint[1]); //- Un-Comment This Line for "Replace" purposes!
fclose($OpenFile); //- DO NOT CHANGE
echo $DataPrint[1]; //- DO NOT CHANGE
echo ""; //- DO NOT REMOVE

?>

______________________________________

surfin2u

4:29 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



It works fine for me. Many hosting outfits block scripts from accessing other sites.

MrKool

8:31 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



Thnx for your reply. Do you know any php supported host where i can run this script.

surfin2u

9:57 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



Sorry, I don't know of any hosts that permit sites to read content from other sites. I've never looked into it. I ran your script on my own desktop machine.

jatar_k

10:43 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



any host who supports curl will allow you to but you will have to rewrite your script not to use fopen to grab a webpage.

Your present host may even have it installed.
CURL, Client URL Library Functions [ca.php.net] or even fsockopen [ca.php.net]

MrKool

11:22 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



I am not very expert at php, I don't know how to rewrite the code with different methods. Can you guide me please.