Showing posts with label fanfeedr. Show all posts
Showing posts with label fanfeedr. Show all posts

Apr 7, 2010

problems


I am going to blog about some of my problems that I have run into. I am going to start with the end and work my way back. I had my site working almost exactly how I wanted it to work last night. I then showed my site to someone today and my wunderground.com api decided to not work.

I started to freak out and still am a little. I have come to the conclusion that I have tried to send too many requests and weather is making me take a break. The reason I am more confident now is because I was able to get it to work again before I started blogging.

Another problem that I ran into but was able to work around is the fanfeedr api. I went into my profile on fanfeedr and was able to say I wanted to use xml instead of json. With a little more experience in xml I made the switch and had great success.

Mar 29, 2010

My code... looking for some help

I have posted my code and hoping to see if anyone notices where my error or errors are. The first bit of code is my php file.


$url = "http://api.fanfeedr.com/basic/all_scores?appid=735sdkx8cqvh8jbwyfzmr3x7"
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response_body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (intval($status) != 200) die("Error: $response_body");
var_dump(json_decode($response));
?>





This piece of code is my javascript. I am sorry I don't know how to post code like Adam did, where it was more organized. I used the blockquote which seemed to help the spacing.

function checkRival() {
fanfeedr();

}

function createRequest() {
try {
request = new XMLHttpRequest();
} catch (tryMS) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (otherMS) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
}
}
}
return request;
}



function fanfeedr() {
createRequest();

if (request == null) {
alert("Unable to create request");
return;
}
var url= "getFeedr.php";
request.open("GET", url, true);
request.onreadystatechange = displayFeedr;
request.send(null);
}
function displayFeedr() {
if (request.readyState == 4) {

if (request.status == 200) {
alert("here");
//var myObject = eval('(' + myJSONtext + ')');
detailDiv = document.getElementById("fanfeedr");
detailDiv.innerHTML = request.responseXML;

}
}
}




I think I need to fix how this is being displayed. I wrote in a previous blog comment that I was going to look at what Adam wrote and try and incorporate some of that. I am not sure that will work or not but is always worth a try. Does anyone else have any more suggestions for me?

Mar 8, 2010

Work on iteration 2

Iteration 2 has been more of a challenge for me then iteration 1. The reason it is more challenging is because I am making it more challenging. The only problem is now I am the frustrating period and not getting past it.

The first thing I attacked was including the api fanfeedr to my iteration 1. I started coding and then decided to learn more about css and format instead of staying on topic with the project. After getting back to fanfeedr, I registered for my api key. The good news was the key was free and didn’t take very long for the key to be sent to my e-mail. After looking at more code and trying to incorporate fanfeedr, I have realized that fanfeedr code is in the form of JSON and not XML.

So, this marks my first problem. I looked around and could not find how to parse the format JSON. I am going to try and do a search on the blog and maybe someone from last semester had a similar situation. I then ran into the problem that my original iteration decided not to work. So, I then proceeded to create a test folder for the fanfeedr. So, I just about started over but was not too hard with copying most of my code. I then didn’t have to worry about ruining something that already works. Once I get it to work then I can just slide it into my working original iteration.


For Wednesday, I am going to just try and use an easier API that I will hopefully be able to produce. I am going to keep holding onto the fanfeedr information and try and incorporate it into my project for possibly iteration 3.

Does anyone have any experience with Google Maps and getting it to work? My question is how do you the maps that you have in your my maps folder?