Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7767687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:44:18+00:00 2026-06-01T15:44:18+00:00

header(‘Access-Control-Allow-Origin: *’); $tmpFile = ‘tmpFile.txt’; $val=http://rss.news.yahoo.com/rss/topstories; $curlHandle = curl_init($val); $filePointer = fopen($tmpFile, w); curl_setopt($curlHandle,

  • 0
 header('Access-Control-Allow-Origin: *');
 $tmpFile = 'tmpFile.txt';

 $val="http://rss.news.yahoo.com/rss/topstories";
  $curlHandle = curl_init($val);  
 $filePointer = fopen($tmpFile, "w");  
 curl_setopt($curlHandle, CURLOPT_FILE, $filePointer);  
 curl_exec($curlHandle);
 curl_close($curlHandle);
 fclose($filePointer); 

 $linesArr = file($tmpFile);  
 foreach($linesArr as $eachLine){
 echo($eachLine);
}

The program supposed to fetch all the materials from yahoo rss sites and output them into the tmpFile.

After executed the program, I opened up the tmpFile.txt. It shows

c1.ops.sp1.yahoo.com uncompressed/chunked Wed Apr 11 01:46:41 UTC 2012 –>

This doesn’t look right. I pasted the url http://rss.news.yahoo.com/rss/topstories there are plenty of materials returned.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:44:19+00:00Added an answer on June 1, 2026 at 3:44 pm

    What you needed was curl_setopt($curlHandle, CURLOPT_ENCODING , "gzip"); …. yahoo uses compression for its rss feed …

    Additional Information Include .

    A. CURLOPT_USERAGENT…. Its nice if you don;t what to start looking like spam

    B. CURLOPT_TIMEOUT… Just for effeciency

    C. CURLOPT_FOLLOWLOCATION .. Becasue of issues with clean URL and routes

    Working Code

    header ( 'Access-Control-Allow-Origin: *' );
    $tmpFile = 'out.txt';
    
    $val = "http://rss.news.yahoo.com/rss/topstories";
    $curlHandle = curl_init ( $val );
    $filePointer = fopen ( $tmpFile, "w" );
    curl_setopt ( $curlHandle, CURLOPT_FILE, $filePointer );
    curl_setopt($curlHandle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2');
    curl_setopt($curlHandle, CURLOPT_ENCODING , "gzip");
    curl_setopt($curlHandle, CURLOPT_TIMEOUT,5);
    curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_exec ( $curlHandle );
    curl_close ( $curlHandle );
    fclose ( $filePointer );
    
    $linesArr = file ( $tmpFile );
    foreach ( $linesArr as $eachLine ) {
        echo ($eachLine);
    }
    

    I hope this helps .. let me know if you need anything more

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Header: <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js type=text/javascript></script> <script src=http://mysite.com/public/delete.js type=text/javascript></script> View: <ol> <?php foreach($sqlplaces->result() as $place): ?>
The header Cache-Control: max-age=0 implies that the content is considered stale (and must be
header('P3P: CP=IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA'); I've never
header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Cache-Control: private,false); header(Content-type: application/force-download); header(Content-Disposition: attachment;
The HTTP Accept header can specify priority using the q specifier, such as application/xml;q=0.8
header('content-type: application/xml'); echo '<'.'?xml version=1.0?'.'>'; echo '<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>';
The Header control we use holds a jquery reference. When I attempt to leverage
What does the Host: header look like for a Unicode domain. e.g. æon.com in
is there any header or method in http protocol which allows you to get
header(Content-type: image/jpeg); $image= imagecreate(120,50); $txt=hello world!; $bg= imagecolorallocate($image,255,255,255); $clr= imagecolorallocate($image,0,0,0); imagettftext($image,12,0,5,35,$clr,'font.ttf',$txt); imagejpeg($image); this works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.