This is a public chat log generated from the #semsol IRC channel.
08:15:43
bengee, welcome back :-D
08:16:07
heya :)
08:16:27
how was your vacation
08:16:29
?
08:16:38
too short ;)
08:17:41
good morning, phpists
08:18:00
does anyone have a nice code snippet for fetching textual content of an url (maybe even caching) ... for installations whose 'open file by uri' option is turned off?
08:20:28
hmm
08:24:47
danbri: Please elaborate
08:25:11
he needs an fsockopen or curl snippet
08:26:46
bengee, won't file_get_contents($url) do the job?
08:26:54
yeah. dreamhost seems to have curl installed, but the snippet i found seems to print the text to the page, not into my variable
08:27:28
i'm trying to glue Google's Social Graph API (which emits json) into Yahoo's SearchMonkey, which requires http://wiki.foaf-project.org/DataRSS
08:27:45
speed is pretty critical, so cache would be needed eventually
08:27:50
rgeorgy, that would need "allow_url_fopen", I guess
08:28:03
parsing http://socialgraph.apis.google.com/otherme?pretty=1&q=danbri.org
08:29:08
yup, http://wiki.dreamhost.com/index.php/Allow_url_fopen - The PHP option allow_url_fopen would normally allow a programmer to open, include or otherwise use a remote file using a URL rather than a local file path. For security reasons, DreamHost has disabled this feature; however, a feature-rich alternative exists in the form of the bundled cURL library,
08:29:17
-> http://wiki.dreamhost.com/CURL#Fetching_a_web_page ... has the code snippet i need. Thanks for listening ;)
08:29:33
ah, cool
08:30:18
there is an example on http://php.net/fopen, too
08:30:53
"function get_content..." in the user comments
09:22:39
thanks!
13:52:38
next php question :)
13:53:00
anyone got a snippet that takes a list of urls and figures out which have human friendly html at the end, which are just rdf gibberish?
13:53:11
eg. http head requests
13:53:21
am working on http://www.foaf-project.org/otherme.php
13:59:19
danbri - that doesn't answer properly ... whether I pass "Accept: application/rdf+xml" or "Accept: */*", I always get back "Content-Type: text/plain"
13:59:42
yes, it's a hardcoded hackjob currently
14:00:09
i'm trying to bodge data from google's sgapi into yahoo searchmonkey
14:00:22
former only emits json, latter only eats datarss
14:00:51
unfortunately i can't distinguish from the json between urls that are human vs machine readable
14:01:04
no, you wouldn't be able to ...
14:01:12
because it's not just URL that matters
14:01:28
ConNeg is a blessing and a curse
14:02:00
(note that HTML isn't human readable, either -- though it's HTML Browser renderable...)
14:02:39
whether RDF is gibberish depends on the browser and human dealing with it...
14:02:55
RDF/XML certainly looks like gibberish, unless you have a good XML renderer, and even then
14:03:12
but RDF/N3 is often much clearer
14:03:58
and if you have something that pre-processes some/most/all URIs into human-friendly text and presents triple statements in a table ... RDF can be quite human friendly
14:04:26
not that I've been wrestling with this much lately :-/
14:06:28
unfortunately, you won't be able to learn much more from the HTTP HEAD responses than from the URLs, as so many production/deployment servers currently do as your hack job does -- delivering whatever they want, regardless of the request, and not always matching the data with the HEAD description of that data
14:09:49
well it should do for a start. i'll ask for more info in the google sgapi json probbly
