Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Pubcon Platinum Sponsor 2014
Which function do i need to read the page through http? GreenLeaf
I need read the html page through http and extract the links from it. Which function is better to use for this purpose: fopen() + fread(), file_get_contents(), or fsockopen()? Thanks.
if the fopen wrappers are installed I like to use file_get_contents() since it fetches all the html right into a string ready for me to process. GreenLeaf
I'm sorry for silly question, but how could i know are the fopen wrappers installed or not?
Are there any advantages of using fsockopen() over file_get_contents()? patrickrock
try this and see what happens
if it spits out the webpage well the wrappers are enabled. =)
They are probably enabled. just test it and see.
Welcome to WebmasterWorld, patrickrock, and good insight. The PHP developers mention that " file_get_contents() [ php.net] is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance."
As long as allow_url_fopen [ php.net] is enabled in php.ini, you can use HTTP and FTP URLs with most of the functions that take a filename as a parameter.
Using remote files [ php.net]
Should get you going down the right path, anyway ;)
Thanks a lot, Patrickrock and Coopster!