note 19497 added to function.curl-exec

From: Date: Fri, 01 Mar 2002 00:06:43 +0000
Subject: note 19497 added to function.curl-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-27208@lists.php.net to get a copy of this message
fyi - if you are having problems getting a webpage to display in your webpage with curl_setopt(CURLOPT_RETURNTRANSFER, 1); due to version bugginess perhaps, you may can use output control functions like this to show a web page inside your webpage: <html><head><title>whatever</title></head> <body> <script language="php"> $ch = curl_init("http://www.cocoavillage.com/"); // use output buffering instead of returntransfer -itmaybebuggy curl_exec($ch); curl_close($ch); $retrievedhtml = ob_get_contents(); ob_end_clean(); // if you intend to print this page with meta tags, better clear out any expiration tag // $result = preg_replace('/(?s)<meta http-equiv="Expires"[^>]*>/i', '', $retrievedhtml); // for now I just want what is between the body tags so need // somehow cut the header footer $bodyandend = stristr($retrievedhtml,"<body"); // not needed- $positionstartbodystring = strlen($retrievedhtml)-strlen($bodyandend); $positionendstartbodytag = strpos($bodyandend,">") + 1; // got to change all to lowercase temporarily // because end body may be upperlowercasemix // to bad strirstr does not exist $temptofindposition=strtolower($bodyandend); $positionendendbodytag=strpos($temptofindposition,"</body"); //now to get the endbetween body tags $grabbedbody=substr($bodyandend, $positionendstartbodytag, $positionendendbodytag); //be sure to fix syntax broke by display on phpwebsite... like above line print("$grabbedbody"); </script> </body></html> tada -- http://www.php.net/manual/en/function.curl-exec.php http://master.php.net/manage/user-notes.php?action=edit+19497 http://master.php.net/manage/user-notes.php?action=delete+19497 http://master.php.net/manage/user-notes.php?action=reject+19497

« previous php.notes (#27208) next »