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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:44:14+00:00 2026-06-11T08:44:14+00:00

I am trying to execute a url using Curl and i am getting empty

  • 0

I am trying to execute a url using Curl and i am getting empty output.

However, if we copy-paste Same url in Browser, we are getting value

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20%28%22YHOO%22,%22AAPL%22,%22GOOG%22,%22MSFT%22%29&env=http://datatables.org/alltables.env&format=json

However, when i try same to get value in php using Curl, i am getting Null

php code

 <?php

$BASE_URL = "http://query.yahooapis.com/v1/public/yql"; 



    // Form YQL query and build URI to YQL Web service
    $yql_query = 'select * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT")&env=http://datatables.org/alltables.env';
    $yql_query_url = $BASE_URL . "?q=" .$yql_query. "&format=json";


    // Make call with cURL
    $session = curl_init($yql_query_url);
    curl_setopt($session, CURLOPT_RETURNTRANSFER,true);
    $json = curl_exec($session);


    echo "<pre>";
    print_r($json);exit;

?>

Any suggestion ??????

  • 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-11T08:44:16+00:00Added an answer on June 11, 2026 at 8:44 am

    Following code is working for me

    <?php
    
    $BASE_URL = "http://query.yahooapis.com/v1/public/yql"; 
        $query = 'select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20%28"YHOO","AAPL","GOOG","MSFT"%29&env=http://datatables.org/alltables.env&format=json';
        echo $yql_query_url = $BASE_URL . "?q=" .$query;
    
    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$yql_query_url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
        $content = curl_exec ($ch);
        curl_close ($ch);
        print_r($content);
    ?>
    

    Query must be properly encoded .

    Check it

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

Sidebar

Related Questions

I am trying to execute an SOAP-function using cURL (because I get an error
i am trying to post data via HTTP Post using name value key pair.
The form I am using requires a copy pasted URL. I am trying to
I'm trying to execute a query using a PreparedStatement in Java. I am getting
Trying to execute powershell script in my C# code. Using .NET Framework v. 4.0.30319
I'm trying to execute command prompt commands and read the output in C#. This
I'm trying to execute the following code, but I'm getting SyntaxError: invalid syntax at
I'm trying to execute my controller from javascript using jquery... here is my jquery
I have been trying to post login credentials to an https site using cURL
I'm using TinyMCE and want to execute a php script get the output and

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.