johniem Posted June 1, 2011 Share Posted June 1, 2011 I'm trying to get a remote html page but I'm having a really weird problem. I'm using curl for that and I'm getting the page url from an rss item using simpelpie. $url = $item->get_permalink();//simplepie function echo "<p>Getting $url. </p>"; $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_ENCODING => "", // handle all encodings CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; if($err != 0) echo " $err : $errmsg</p>"; echo $header['content']; My problem is that although the page is loading fine ( no curl errors ) , some tags are missing (and particularly the tags that containing the article content of that page). When I'm hardcoding the url then everything is fine. I tried to print the url that simpepie gets from rss and it's identical with the one that I'm harcoding. So, $url = $item->get_permalink(); not working $url = "http://www.the_same_url.com" working. Any help whould be really appreciated. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/238077-weird-problem-drives-me-crazy/ Share on other sites More sharing options...
johniem Posted June 1, 2011 Author Share Posted June 1, 2011 Solved Well I maybe be a bit noob on that but sometimes you can't check everything. The problem was html entities. Rss was giving me the links with html entities. So a simple html_entity_decode solved my problem. Link to comment https://forums.phpfreaks.com/topic/238077-weird-problem-drives-me-crazy/#findComment-1223413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.