My picSo here is one that got me confused. I thought that the two functions are somewhat equivalent in the matter of reading a page. What i mean is that i thought either using fopen with a URL or create my own wrapper with the socket functions would be the same. How mistaken i was…..

So here is what i did. I thought to my self “hey i can write a simple browser with php… i got the… hmm… cohonas” 😀 Well it didn’t need any at all cause it’s pretty simple once you get the grip of it.

  • Find the ip of the server using the gethostbyname() function
  • Open a socket connection to that ip at port 80
  • Write to the socket the request HTTP headers.
  • Read the result
  • Close the socket
  • Optionaly parse the return headers and remove them from the response.

So that was it. So a few days ago i thought to my self that a nice e107 plugin (that i would port to jasmine too) that will keep my movie collection and show my guests a random one in a block with imdb.com data would be nice. I started coding on my local server. Everything was done in a couple of hours. So i uploaded and tried to use it in stratosector and the surprise was there waiting for me. socket_create was not defined which means that the socket extension in php is disabled !rolleyes I was like damn thos guys man!! I sent them an e-mail and their response was pretty resonable. They said the sockets were closed for flood attacking prevention which sounds about right. But i was obviously disapointed. A couple of days later this thought crossed my mind \”hey, if i use fopen with a URL will the results be the same? If so then they are trully stupid and i got to move out of shared hosting ASAP\”. I tried and what a miracle! I got another error BUT not the same 🙂 What it said was that fopen is not allowed to open URL\’s from the php.ini !!!!! But hey i can change that. I did and everything worked ok. Shared hosting still stands for me for now at least. Anyway i was realy surprised with this outcome and i thought i\’d share this with yall so no unessesary coding is done. By the way after that i created the tf2 sig generator and as you can see it works just fine.

/me out

PS: Greece, here i come!