Esempio n. 1
0
<?php

include_once 'header.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
$interests = $scoop->getCustomRequest("interest-list");
?>

	Interrests available
	<ul>
		<?php 
foreach ($interests->interests as $interest) {
    echo "<li>{$interest->name} (id:<a href='interest.php?id={$interest->id}'>{$interest->id}</a> shorname:<a href='interest.php?shortName={$interest->shortName}'>{$interest->shortName})</a></li>";
}
?>
	</ul>
	<hr/>
	<p>
		Raw Content of profile Query:<br/>
		<textarea style="width:600px; height: 200px">
		<?php 
print_r($interests);
?>
		</textarea>
	</p>

<?php 
include_once 'footer.php';
Esempio n. 2
0
<?php

include_once 'header.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
//profile url and shortName
$profileUrl = $_GET["profileUrl"];
$shortName = str_replace("http://www.scoop.it/u/", "", $_GET["profileUrl"]);
//resolve profile
$profile = $scoop->resolveUserFromItsShortName($shortName);
?>


	Your profile url is: <code><?php 
echo $profileUrl;
?>
</code>
	<br/>
	Your short name is: <code><?php 
echo $shortName;
?>
</code>
	<br/>
	<hr/>
	
	Topics you are curating are:
	<ul>
		<?php 
foreach ($profile->user->curatedTopics as $topic) {
Esempio n. 3
0
<?php

include_once 'header_inc.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
//profile url and shortName
$topicId = $_GET["id"];
//Pagination
$postPerPage = 30;
$page = 0;
if (isset($_GET["page"])) {
    $page = intval($_GET["page"]);
}
$topic = $scoop->topic($topicId, 0, ($page + 1) * $postPerPage, $page);
//next and previous
if ($page > 0) {
    $prev = "?id=" . $topicId . "&page=" . ($page - 1);
}
if ($topic->curablePostCount / $postPerPage > $page + 1) {
    $next = "?id=" . $topicId . "&page=" . ($page + 1);
}
include_once 'header_html.php';
?>

Your topic id is: <code><?php 
echo $topicId;
?>
</code>
	<br/>
Esempio n. 4
0
<?php

// Start the session
session_start();
// Include needed files
include_once "ScoopIt.php";
include_once "config.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), $localUrl, $consumerKey, $consumerSecret);
// Login in, if not previously logged in, it will issue a redirection
// to scoop.it servers to log the user in.
// You can omit the call below if you want to use the api in "anonymous"
// mode.
$scoop->login();
?>
<html>
	<title>Scoop.it API Test</title>
<body>
	<?php 
// Get the current user
$currentUser = $scoop->profile(null)->user;
// Display the current user name
echo "<h1>Hello " . $currentUser->name . "</h1>";
// Get information about topic with 24001 lid (this can be also
// called in anonymous mode).
$topic = $scoop->topic(24001);
echo "<h2>Information about topic: <img width='32px' src='" . $topic->mediumImageUrl . "' /><i> " . $topic->name . "</i></h2>";
echo "<p>Here is the print_r() output for the object \$topic:</p>";
echo "<center>";
echo "<textarea>";
print_r($topic);
Esempio n. 5
0
<?php

include_once 'header.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
//profile url and shortName
$topicId = $_GET["id"];
//Pagination
$postPerPage = 30;
$page = 0;
if (isset($_GET["page"])) {
    $page = intval($_GET["page"]);
}
$topic = $scoop->topic($topicId, $postPerPage, 0, $page);
//next and previous
if ($page > 0) {
    $prev = "?id=" . $topicId . "&page=" . ($page - 1);
}
if ($topic->curatedPostCount / $postPerPage > $page + 1) {
    $next = "?id=" . $topicId . "&page=" . ($page + 1);
}
?>

	Your topic id is: <code><?php 
echo $topicId;
?>
</code>
	<br/>
	Your topic name is: <code><?php 
Esempio n. 6
0
<?php

include_once 'header_inc.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
//resolve profile
$profile = $scoop->profile(null);
include_once 'header_html.php';
?>

	Your short name is: <code><?php 
echo $profile->user->shortName;
?>
</code>
	<br/>
	<hr/>
	
	Topics you are curating are:
	<ul>
		<?php 
foreach ($profile->user->curatedTopics as $topic) {
    echo "<li>{$topic->name} (<a href='postsToCurate.php?id={$topic->id}'>posts to curate</a>)</li>";
}
?>
	</ul>
	
	<hr/>
	<p>
		Raw Content of profile Query:<br/>
Esempio n. 7
0
<?php

include_once 'header.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
//profile url and shortName
$interestId = $_GET["id"];
$interestShortName = $_GET["shortName"];
//Pagination
$postPerPage = 30;
$page = 0;
if (isset($_GET["page"])) {
    $page = intval($_GET["page"]);
}
$request = "interest";
if (isset($interestId)) {
    $request = $request . "?id=" . $interestId;
} else {
    if (isset($interestShortName)) {
        $request = $request . "?shortName=" . $interestShortName;
    }
}
$request = $request . "&getPosts=true&page=" . $page . "&count=" . $postPerPage;
$interest = $scoop->getCustomRequest($request)->interest;
//next and previous
$paginationUrl = "";
if (isset($interestId)) {
    $paginationUrl = $paginationUrl . "?id=" . $interestId;
} else {
// Start the session
session_start();
// Include needed files
include_once "ScoopIt.php";
//TODO -------------------------------------------------------------------
//TODO -------------------------------------------------------------------
//TODO -------------------------------------------------------------------
//            generate tokens here https://www.scoop.it/dev/apps
//TODO -------------------------------------------------------------------
//TODO -------------------------------------------------------------------
//TODO -------------------------------------------------------------------
$consumerKey = "YOUR_KEY";
$consumerSecret = "YOUR_SECRET";
// Construct scoop var, which handle API communication
$scoop = new ScoopIt(new SessionTokenStore(), "", $consumerKey, $consumerSecret);
?>
<html>
	<title>Scoop.it API Test</title>
<body>
	<h1>Request output</h1>
	<?php 
// Get information about topic http://www.scoop.it/t/iphone-and-ipad-development
// shortName is the last part of the Url of a topic
$topic = $scoop->resolveTopicFromItsShortName("iphone-and-ipad-development");
echo "<center>";
echo "<textarea>";
print_r($topic);
echo "</textarea>";
echo "</center>";
?>
Esempio n. 9
0
<?php

include_once 'header_inc.php';
// Include needed files
include_once "../../ScoopIt.php";
// Construct scoop var, which handle API communication
$localUrl = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$scoop = new ScoopIt(new SessionTokenStore(), $localUrl, $consumerKey, $consumerSecret);
// Login in, if not previously logged in, it will issue a redirection
// to scoop.it servers to log the user in.
// You can omit the call below if you want to use the api in "anonymous"
// mode.
$scoop->login();
include_once 'header_html.php';
// Get the current user
$currentUser = $scoop->profile(null)->user;
// Display the current user name
echo "<h1>Hello " . $currentUser->name . "</h1>";
echo "<hr/>";
echo "<a href='profile.php'>View Topics</a>";