Author Topic: PHP opendir() of an external page  (Read 4896 times)

0 Members and 1 Guest are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
PHP opendir() of an external page
« on: March 31, 2012, 05:07:15 am »
Hey, I wanted to know if, and if how, it is possible to opendir() of an external page, e.g. http://www.google.com

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: PHP opendir() of an external page
« Reply #1 on: March 31, 2012, 08:45:52 am »
No, it is not.
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Netham45

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2103
  • Rating: +213/-4
  • *explodes*
    • View Profile
Re: PHP opendir() of an external page
« Reply #2 on: March 31, 2012, 11:30:53 am »
You could use file_get_contents() to get the html of google, but you couldn't use opendir on it. Opendir only works on a locally-mounted filesystem.
Omnimaga Admin

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: PHP opendir() of an external page
« Reply #3 on: March 31, 2012, 11:32:35 am »
Nope. In fact, your PHP script can't tell at all if something on another server is a directory at all, any more than you (as a user) can (for example, is http://example.com/page1 a directory or a file?).

All you can know is the content that server returns to you. In some places, a site might return a plain-text listing of the directory's contents (such as http://eeems.omnimaga.org/files/), while in other places it might return 403 Forbidden, in order not to show you what's inside. And if there's a file called index.html or default.html or anything like that, of course, that's exactly what the server will show you when you try to open that directory.
« Last Edit: March 31, 2012, 11:40:33 am by Deep Thought »




Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: PHP opendir() of an external page
« Reply #4 on: March 31, 2012, 04:34:41 pm »
Ah, ok, thanks for your help, it seems all-logical :)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!