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 7870061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:30:20+00:00 2026-06-03T01:30:20+00:00

Admittedly, I’m a novice and know only enough to be dangerous. The host server

  • 0

Admittedly, I’m a novice and know only enough to be dangerous.

The host server doesn’t allow file_get_contents due to security concerns. How can I rewrite the code below using curl instead of file_get_contents?

This is for a rss reader on a jquery mobile site. The code is based on a tutorial I found here: nets.tutplus.com/rssreader

<?php
$siteName = empty($_GET['siteName']) ? 'Website' : $_GET['siteName'];
$siteList = array(
'Website2',
'Website3',
'Website4',
'Website5',
'Website6',
);
// For security.
if ( !in_array($siteName, $siteList) ) {
$siteName = 'Website';
}
$location = "http://query.yahooapis.com/v1/public/yql?q=";
$location .= urlencode("SELECT * FROM feed where url='http://feeds.feedburner.com/$siteName'");
$location .= "&format=json";
$rss = file_get_contents($location, true);
$rss = json_decode($rss);
?> 

Edit: Would this work?

$location = "http://query.yahooapis.com/v1/public/yql?q=";
$location .= urlencode("SELECT * FROM feed where url='http://feeds.feedburner.com/$siteName'");
$location .= "&format=json";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, trim($request)); 
$rss = curl_exec($ch);
curl_close($ch); 

$rss = json_decode($rss);
  • 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-03T01:30:22+00:00Added an answer on June 3, 2026 at 1:30 am

    You can remove the CURLOPT_POST... lines entirely. $request is not set, and you don’t need to make a post request in this instance where a GET request will do. You may or may not need to use CURLOPT_FOLLOWLOCATION — turn it on if curl doesn’t already work as needed.

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

Sidebar

Related Questions

Admittedly a misleading title, but I didn't know how to put it better. So
This is an admittedly silly question, but I honestly don't know if this is
I am writing a Wordpress shortcodes plugin for a client and admittedly don't know
Using Python 2.5 and httplib...... I am admittedly a python novice.....but this seems straight
I'm desperately hoping someone can assist me with this error. Admittedly, I'm a novice
Admittedly not a programming question, but I don't really know where else to ask
Compared to most people on this site I am admittedly a novice. I wanted
A persistent follow-up of an admittedly similar question I had asked: What security restrictions
Admittedly, I'm a bash neophyte. I always want to reach for Python for my
In my admittedly young career I've found myself writing code to support quirky business

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.