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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:09:36+00:00 2026-06-01T12:09:36+00:00

Okay so what i am trying to achieve is use the youtube api to

  • 0

Okay so what i am trying to achieve is use the youtube api to fetch some feeds. the feeds are json-c encoded. so i tried using file_get_contents method to convert the json feedurl into a string and json decode it. here is the code snippet:

$feedURL = "https://gdata.youtube.com/feeds/api/videos?q=surfing&v=2&alt=jsonc";
$json = file_get_contents($feedURL,0,null,null);
$result = json_decode($json, true);
echo $result;
$id = $result->{'data'}->{'items'}[0]->{'id'};
echo "The video id is: ".$id;

But i get this stupid error Warning: file_get_contents(https://gdata.youtube.com/feeds/api/videos?q=surfing&v=2&alt=jsonc) [function.file-get-contents]: failed to open stream: Connection refused in /opt/lampp/htdocs/date.php on line 13
Notice: Trying to get property of non-object in /opt/lampp/htdocs/date.php on line 16
Notice: Trying to get property of non-object in /opt/lampp/htdocs/date.php on line 16
Notice: Trying to get property of non-object in /opt/lampp/htdocs/date.php on line 16

The file’s name is date.php and i am running it on localhost on a linux machine behind a proxy server.

i think the connection refused thing suggests there might be an ip conflict or something. I don’t know. Could somebody please help me fix this?

  • 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-01T12:09:38+00:00Added an answer on June 1, 2026 at 12:09 pm

    You can use curl

    $feedURL = "https://gdata.youtube.com/feeds/api/videos?q=surfing&v=2&alt=jsonc";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $feedURL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
    //curl_setopt($ch,CURLOPT_PROXY,"x.x.x.x:8888"); // Proxy Use
    $json = curl_exec($ch);
    
    $result = json_decode($json, true);
    foreach($result['data']['items'] as $items)
    {
        var_dump($items['id']);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so I'm trying to create a Order Posts by Type using jQuery JSON
Okay I'm trying to go for a more pythonic method of doing things. How
OKay I don't use actionscript and trying to help my friend edit a flash
Okay, I'm trying to be clear on this one... I have some insliding boxes,
Okay so I am trying to use a simple UINavigationController with iPhone SDK in
okay so im trying to enter a dynamic meta tag for the facebook api
Okay I am trying to make minecraft mods using eclipse. I used this video
Okay so I am trying to use range for input type Times: <input type=range
Okay so i am trying to write a simple awk to clear out some
Okay, another SQL question. What I am trying to achieve is to show by

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.