I need to check xml feeder updated date and updated date from my database and get just updated date that are not exists in my database.
I am doing that because i need to get just odds changes from last time that parser start.
But there is problem it's stuck and nothing happened, just loading page, all day.
Here is code:
$updDate = $this->PDO->prepare("select distinct FixtureMatch_Id,UpdatedDate from odds");
$updDate->execute();
$updDate->setFetchMode(PDO::FETCH_ASSOC);
while($row = $updDate->fetch()){
$odds=$this->soccer->GetAllOddsByFixtureMatchId(
array("fixtureMatch_Id"=>$row['FixtureMatch_Id']))
->xpath("//Odds[not(contains(UpdatedDate,$row['UpdatedDate']))]");
echo $row['FixtureMatch_Id'] . ' : ' . $row['UpdatedDate'] . '<br>';
}
}
this is how it looks when i var dump without xpath like this:
$odds=$this->soccer->GetAllOddsByFixtureMatchId(
array("fixtureMatch_Id"=>$row['FixtureMatch_Id']))->OddsList->Odds;
xml
object(SimpleXMLElement)[11]
public 'FixtureMatch_Id' => string '325006' (length=6)
public 'Bookmaker' => string 'Pinnacle' (length=8)
public 'UpdatedDate' => string '2015-05-23T14:58:51.213' (length=23)
public 'Type' => string 'Over/Under 2.5' (length=14)
public 'HomeOdds' => string '1.85' (length=4)
public 'AwayOdds' => string '2.08' (length=4)
Update: In database is abount 16000 rows in odds table, is it problem?
Related
i am trying to get some values out of an Std Object in Laravel.
I can get anything out, with no problem, but not the last one
my object looks like this (var_dump())
object(stdClass)[208]
public 'id' => int 2
public 'vorname' => string 'Thomas' (length=5)
public 'nachname' => string 'Kemmet' (length=5)
public 'geburtstag' => string '1988-05-05' (length=10)
public 'verein_id' => int 1
public 'verein_name' => string 'Kolandorf' (length=20)
public 'game' => string '2016-10-28' (length=10)
when i do
echo $spieler->id;
i get the id. But when i try
echo $spieler->game;
i get an error with Undefined property: stdClass::$game
why is it like this? and how to get the last value...
Make sure that the game field is a string in the database you retrieve it from.
Try changing the order of the fields in order to see if its always the last one which has the problem.
I'm creating e-commerce shop with Amazon API integration.
The problem I faced with is I cannot get items from specific node.
So I've tried many ways to do that, last one was something like this:
$fields = array();
$fields['AssociateTag'] = "ItemSearch";
$fields['Condition'] = 'All';
$fields['Operation'] = 'ItemSearch';
$fields['Version'] = '2013-08-01';
$fields['BrowseNode'] = $catId;
$fields['ResponseGroup'] = "Images,ItemAttributes,Offers";
$fields['Service'] = 'AWSECommerceService';
$fields['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
$fields['AWSAccessKeyId'] = $this->accessKey;
After that call I have the output:
public 'Items' =>
object(SimpleXMLElement)[150]
public 'Request' =>
object(SimpleXMLElement)[139]
public 'IsValid' => string 'True' (length=4)
public 'ItemSearchRequest' =>
object(SimpleXMLElement)[138]
public 'BrowseNode' => string '1289481011' (length=10)
public 'Condition' => string 'All' (length=3)
public 'ResponseGroup' =>
array (size=3)
0 => string 'Images' (length=6)
1 => string 'ItemAttributes' (length=14)
2 => string 'Offers' (length=6)
So I can see my request, but no items were returned to me.
By the way, ItemLookup, ItemSearch with keywords and BrowseNode operations work just fine.
What can I do to get items from node with spicific ID without using keywords?
I figured out what happened. I didn't set SearchIndex when I point BrowseNode ID.
So there was no result.
i have a problem here...im trying to show the feed of a blog(wordpress) in my website...and that is the return what i have...i already have the image, title and link of the post...but the description is coming like an xml object...i tried to read that but i had not success...someone can help me??
object(SimpleXMLElement)[74]
public 'title' = string '10 curiosidades sobre a Pizza' (length=29)
public 'link' = string 'www.site.com.br/blog/index.php/10-curiosidades-sobre-a-pizza/' (length=71)
public 'comments' = string 'www.site.com.br/blog/index.php/10-curiosidades-sobre-a-pizza/#comments' (length=80)
public 'pubDate' = string 'Wed, 14 Aug 2013 13:08:49 +0000' (length=31)
public 'category' =>
object(SimpleXMLElement)[76]
public 'guid' = string 'www.site.com.br/blog/?p=1254' (length=38)
public 'description' =
object(SimpleXMLElement)[75]
public 'enclosure' =
object(SimpleXMLElement)[77]
public '#attributes' =
array (size=3)
'url' = string 'www.site.com.br/blog/wp-content/uploads/2013/08/pizza-RC-Fones-150x150.jpg' (length=84)
'length' = string '9873' (length=4)
'type' = string 'image/jpg' (length=9)
You need to use the methods of the SimpleXMLElement class to extract the information you need. So, for example, to get the title, use $title = $object->title;.
Some of those items are themselves SimpleXMLElement objects. To get information out of them, simply do the same thing:
// assuming the description has a title...
$description = $object->description->title;
I'm trying to get some basic event info from a public google calendar. In PHP it looks like this:
$xml = simplexml_load_file('http://www.google.com/calendar/feeds/[username]/public/basic?start-min=2014-01-01T00:00:00&start-max=2016-03-24T23:59:59');
var_dump($xml);
This brings back the XML data as expected, with the event data.
public 'id' => string 'http://www.google.com/calendar/feeds/[username]/public/basic/k524jsujs242bag0fsqfveiij8' (length=98)
public 'published' => string '2014-01-29T21:04:51.000Z' (length=24)
public 'updated' => string '2014-01-29T22:12:20.000Z' (length=24)
public 'category' =>
object(SimpleXMLElement)[1996]
public '#attributes' =>
array (size=2)
'scheme' => string 'http://schemas.google.com/g/2005#kind' (length=37)
'term' => string 'http://schemas.google.com/g/2005#event' (length=38)
public 'title' => string 'busy' (length=4)
public 'summary' => string 'When: Thu Jan 30, 2014 11am to 12pm PST<br>' (length=49)
My problem is that in the events, none of the Titles are populated-- they all simply show "busy", even though there is a valid title saved in the actual calendar event.
Anyone know how to get the actual event title?
Problem was that the calendar, while public, wasn't set in the Google Apps admin to share ALL event data.
See here for more info: https://productforums.google.com/forum/#!topic/calendar/-YcGbl1uw5Y
Suppose you have this array with objects:
array
0 =>
object(User\Entity\User)[297]
public 'id' => int 1
private 'first_name' => string 'Peter' (length=5)
private 'last_name' => string 'Johnson' (length=7)
private 'initials' => string 'J.J.' (length=4)
private 'email' => string 'test#gmail.com' (length=21)
1 =>
object(User\Entity\User)[296]
public 'id' => int 2
private 'first_name' => string 'Edith' (length=8)
private 'last_name' => string 'Peters' (length=7)
private 'initials' => string 'R.J.' (length=4)
private 'email' => string 'edit#gmail.com' (length=26)
Now i want to put them in a table. But since i want to make it universal i try to do it on an abstract way.
I have a $aColnames array in the function below in to be able to only show the get the values of the fields i want to see in the table.
This is the method i am trying to build:
private function generateTable()
{
foreach($this->aData as $aData){
$this->sTable.= '<tr>';
foreach($this->aColnames as $sColname){
$this->sTable.= '<td>';
/****What code goes here ****/
$this->sTable.= '</td>';
}
$this->sTable.= '</tr>';
}
}
The question is no how do i get the values from the objects? Do i need to instantiate the objects each time? Can anyone help me out please?
No, you do not need to instantiate the objects again. They are instantiated when you placed them in the array in the first place!
You will however need to either declare these variables public, so that they may be accessed, or have some sort of getter functions.