/    Sign up×
Community /Pin to ProfileBookmark

File open url

I’m building a script to grab text and content from a html. The content gets rebuilt into an XML to give to Flash.

I’ve got a basic version running using this [url=http://planet.keks.com/about/index.php]xml2html parser[/url]. I just use Flash to parse the garbage that gets returned from;

[url]http://www.robotacid.com/assets/toxml.php[/url]

eg:

[url]http://www.robotacid.com/assets/toxml.php?url=http://www.robotacid.com/splash.html[/url]

But I would rather be building an XML that Flash can read without getting Flash to do all the hard work (ie: CDATA tags, image files as separate nodes, etc.), but I don’t know how to open a remote file for reading. The following code doesn’t work:

[code]
$url = $_GET[‘url’];
$fp = fopen($url, ‘r’) or die(“failed to open html”);
$fileString = fread($fp, filesize($url));
fclose($fp);
[/code]

I get a no such file or directory.

The XML parser seems to able to read from any address, but I can’t isolate the commands responsible. Can anyone help me please?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Dec 29.2006 — You're probably getting "stuck" on the remote filesize().

You need to take a look at: http://www.php.net/manual/en/function.file-get-contents.php

If your host doesn't allow [B]file_get_contents()[/B] then try your hand at cURL, if that's available on your system (http://www.php.net/manual/en/ref.curl.php)
×

Success!

Help @st33d spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...