Skip to main content
3 of 4
deleted 1575 characters in body
austin
  • 171
  • 3

trying to query answers for a question using the stack.php

I am trying to query stackoverflow and route it to my website via the following

<?php
require_once './stackphp_source_0.4/src/api.php';
require_once './includes/function.php';

// Begin by getting a Site object for Stack Overflow.
// We can use 'stackoverflow' or 'stackoverflow.com' here.

$question = new QuestionRequest('http://www.stackoverflow.com', null);
$question = $question->Search("C#");

// paged Response object
$page = $question->Answers()->Exec(); 

?>


<html>
    <head>
        <?php
            include("includes/bootstrap.php");
        ?>
        
          <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Stack.PHP - User's Questions</title>
  <!-- <link rel='stylesheet' type='text/css' href='../common/style.css' /> -->

    </head>
    <body>
        <?php include("includes/banner.php"); ?>
        
        <div class="main_content">
              <h2>Questions Asked By User #1 on Stack Overflow</h2>
              
              <?php echo $page->Fetch(); ?>
        </div>


    <?php include("includes/script_includes.php"); ?>
    </body>
</html>

I keep getting the error

Curl was unable to retrieve the data from the specified URL.

Any thoughts

EDIT ----------------------

thank you this worked.

austin
  • 171
  • 3