Jump to content

curl help


DanielBP

Recommended Posts

Hello. I'm new to php and I have a problem with a script. If someone could help me I will apreciate it. So, I'm using this script to get data from my Gamespot profile (level, date joined, etc). The problem is I don't know how to get multiple "things" from my profile. I made 2 similar examples based on that script but I want to make them in a single script if you know what I'm trying to say. So in the end it should display information from both my examples in one page.

 

<?php

// Inlcude our tag grab class
require("taggrab.class.php"); // class for spider

//Username
define('username','twistedface12');

// Enter the URL you want to run
$urlrun="http://www.gamespot.com/users/".username."/achievements/gamespot";

// Specify the start and end tags you want to grab data between
$stag='<ul class="profile_stats">';
$etag="</ul>";

// Make a title spider
$tspider = new tagSpider();

// Pass URL to the fetch page function
$tspider->fetchPage($urlrun);

// Enter the tags into the parse array function
$linkarray = $tspider->parse_array($stag, $etag); 

echo "<h2>".username."'s Stats - <a href=".$urlrun.">Source</a></h2><br />";
// Loop to pump out the results
foreach ($linkarray as $result) {

echo $result;

echo "<br/>";
}

?>

 

and the second example shows all emblems

 


<?php

// Inlcude our tag grab class
require("taggrab.class.php"); // class for spider

//Username
define('username','twistedface12');

// Enter the URL you want to run
$urlrun="http://www.gamespot.com/users/".username."/achievements/gamespot";

// Specify the start and end tags you want to grab data between
$stag='<ul class="achievements ">';
$etag="</ul>";

// Make a title spider
$tspider = new tagSpider();

// Pass URL to the fetch page function
$tspider->fetchPage($urlrun);

// Enter the tags into the parse array function
$linkarray = $tspider->parse_array($stag, $etag); 

echo "<h2>".username."'s emblems - <a href=".$urlrun.">Source</a></h2><br />";
// Loop to pump out the results
foreach ($linkarray as $result) {

echo $result;

echo "<br/>";
}

?>

 

How can I merge those 2 ? Thank you.

Link to comment
https://forums.phpfreaks.com/topic/246365-curl-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.