Hi:
I want to use php to read the html source code of a web page or store the html source code to a string. However, I failed. Anyone can help me?
------the code starts------------------- <?php $fp = fopen("http://www.dealtime.com/hardware/hardware.asp?B=dealtime&AID=0&UID=22660177","r"); $content=fread($fp,129); echo $content; ?> -----the code ends----------------------------
------the response starts-------------------------- Warning: fopen("http://www.dealtime.com/hardware/hardware.asp?B=dealtime&AID=0&UID=22660177","r") - Transport endpoint is not connected in /home/httpd/html/myBaoBay/module/try.php3 on line 3
Warning: Unable to find file identifier 0 in /home/httpd/html/myBaoBay/module/try.php3 on line 4 ------the response ends-------------------------------
This is the code I use to read from a page, and it does work:
$furl=fopen("http://$GLOBALS[sys_default_domain]/write_cache.php?function=".urlencode($function),'r');
return stripslashes(fread($furl,200000));
Hey there! This one works fine for me. Try it!
$function = "dealtime&AID=0&UID=22660177"; $url = "www.dealtime.com"; $furl=fopen("http://$url/hardware/hardware.asp?B=".$function,'r');
echo stripslashes(fread($furl,200000));