?

Log in

No account? Create an account

Previous Entry | Next Entry

php file encoding and underscores?

So I'm trying to write some livejournal stuff and having a heck of a time. Maybe someone has an idea for this one.

I need to fetch some xml files, which livejournal makes readily available, yay.

I've tried two different ways to open these files...

first curl:
curl_init($url);

then xml parsing with DOM:
$xmlDoc = new DOMDocument();
$xmlDoc->load($url);

in both cases, some of the files I want give me a "failed to open" sort of error. The ones that do not work have one thing in common: underscores. But some of the files that work have underscores too. So I give up.

Examples of files that work, every time... I can open these just fine:
http://adefinitemaybe.livejournal.com/data/foaf.rdf
http://spacefem.livejournal.com/data/foaf.rdf
http://u_b_c.livejournal.com/data/foaf.rdf

Examples of files that totally do NOT work ever... I get a "not found" error in my script even though I can open them in a browser!
http://_frangible_.livejournal.com/data/foaf.rdf
http://i_love_freddie.livejournal.com/data/foaf.rdf
http://katie____.livejournal.com/data/foaf.rdf

not sure if I have any coders reading here anymore but if I do... help? (and if you don't want to comment, then spacefem@spacefem.com)

Comments

( 10 comments — Leave a comment )
spikesgirl58
Feb. 24th, 2015 04:28 pm (UTC)
Wow, talk about another language! Not one I speak, just wanted to tip my hat to anyone who does understand this.
babygrl7296
Feb. 24th, 2015 06:11 pm (UTC)
Seconded.
spacefem
Feb. 24th, 2015 06:22 pm (UTC)
Ha ha! Well that's okay, although you are missing out on tons of fun by not writing XML parsing applications in php!

Maybe you guys can help me beta test some of this if I ever get it working, I'm hoping for some nice tools that we can use to observe how our friends lists are doing.
spikesgirl58
Feb. 24th, 2015 06:42 pm (UTC)
You can count on my help! Always ready to muck it up for a friend.
spikesgirl58
Feb. 24th, 2015 06:43 pm (UTC)
You can count on my help! Always ready to muck it up for a friend.
astrogeek01
Feb. 24th, 2015 05:28 pm (UTC)
is there a way to escape the underscores (e.g. \_)? I'm surprised that underscores would be the problem though, usually those are fine.

(eta: oh wait, re-read, it's failing on both the curl_init($url) and also separately on the load($url)?)

Edited at 2015-02-24 05:31 pm (UTC)
lepid0ptera
Feb. 24th, 2015 09:50 pm (UTC)
Can you paste the exact error?
jume
Feb. 26th, 2015 05:36 am (UTC)
I don't know much PHP anymore (ever at all), but I tried this, and it returned the XML (rendered as html, of course)



jume
Feb. 26th, 2015 05:37 am (UTC)
It displayed fine in preview, but I guess LJ ate it (rightfully so). Have a pastebin: http://pastebin.com/7ZQEBCea
microxcuts
Feb. 26th, 2015 08:24 pm (UTC)
I'm a coder but unfortunately I'm not sure how does that fetching work...
( 10 comments — Leave a comment )

Latest Month

July 2017
S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
Powered by LiveJournal.com
Designed by Tiffany Chow