Jump to content

seblondres

Members
  • Content Count

    50
  • Joined

  • Last visited

Everything posted by seblondres

  1. Thanks for taking the time to answer my question. I have tried $result->Offer->Merchant->Logo->Url but unfortunately it still doesn't picking up the merchant logo url while I don't have any problems to get to the other child nodes.
  2. Hi, I have this code below to retrieve the products from the XML further down, I can get to any children but the Merchant logo URL. If someone could please let me know how to reach the Merchant logo URL. foreach ($productsResult->Products->Product as $result) { echo "<a href=".$result->Offer->Url." target='_blank'><img class='productImg' src=".$result->Offer->Images[0]->Image->Url."/></a>"; echo "<p><b class='price'>£".$result->Offer->Price->Price."</b></p><br>"; echo "<p><img src=".$
  3. Ok I found a solution to my post: $keywords = explode("\n", file_get_contents('keywords.txt')); $search = $keywords[ array_rand($keywords) ]; Instead I passing the random keywords as a query keyword='.$search.' in my API url: e.g. $productsResult = simplexml_load_file('http://site.com?publisherId=xxx&placementId=&categoryId=&keyword='.$search.'&apiKey=xxxx'); Thanks,
  4. Hi, I have this script below which select random keywords from a file: <?php $search = explode("\n", file_get_contents('keywords.txt')); $search[ array_rand($search) ]; ?> Now I want to randomly pass those keywords in an URL so I can $_Get them e.g. http://example.com/index.php?keyword={A random keyword from my text file} If someone could point me to the right direction. Many Thanks,
  5. seblondres

    Indeed API

    Hi, I'm trying to detect whether <totalresults> = 0 from the Indeed API. Here is the code I'm using: <?php $search ='oihhb'; $xml = simplexml_load_file('http://api.indeed.com/ads/apisearch?publisher=xxxxxx&q='.$search.'&l=&sort=&radius=&st=&jt=&start='.$start.'&limit=1&fromage=&filter=&latlong=1&co=fr&chnl=&userip=1.2.3.4&useragent=Mozilla/%2F4.0%28Firefox%29&v=2'); foreach($xml->results->result as $result) if ($xml->totalresults == 0) { echo 'empty'; } else {
  6. Got it, thanks! <?phpinclude_once 'simple_html_dom.php';$search_term = array( "lyon", "cannes", "paris", "marseille" );for($i=0;$i<count($search_term);$i++){ $city = $search_term[$i]; $url = "http://www.pole-emploi.fr/annuaire/?TypeServices=0&VilleLieu={$city}&annusearch=1&Chercher=Chercher";$html = file_get_html($url);$ret = $html->find('div[class=Annuaire-int]');foreach($ret as $story) echo $story;}?>
  7. Thanks for your reply. I'm not sure what you mean exactly, would you be able to send me an example or to point me to a link/doc? Many Thanks,
  8. I've tried the following but I can only display the information for Paris: <?phpinclude_once 'simple_html_dom.php';$search_term = array( "lyon", "cannes", "paris" ); foreach ($search_term as $search_term) { $url = "http://www.pole-emploi.fr/annuaire/?TypeServices=0&VilleLieu={$search_term}&annusearch=1&Chercher=Chercher";}$html = file_get_html($url);$ret = $html->find('div[class=Annuaire-int]');foreach($ret as $story) echo $story;?>
  9. I just want to search one term at the time, something with foreach perhaps
  10. Hi, I have the script below which works fine when searching 1 term (city). Now what I like to do, it's to search through multiple terms, so how can I pass one term after the other into the $url so I can get the result for each term on the same page. Ideally I'd like to be able to read a txt file with all the terms (cities). <?phpinclude_once 'simple_html_dom.php';$search_term = "paris";$url = "http://www.domain.net/annuaire/?TypeServices=0&VilleLieu={$search_term}&annusearch=1&Chercher=Chercher";$html = file_get_html($url);$ret = $html->find('div[class=Annuaire-int]');
  11. ok good to know, I'll put more information next time. thanks a lot!
  12. ok I solved my problem, the below does what I want: <?php$city = $_GET['city'];$url = ('http://www.test2.com/directory/'. $city );?> Thanks,
  13. Thanks for your answers: The variable $url would be used to scrape this page for example: http://www.test2.com/directory/london-greenwich Here is how it should works: 1. I'm on the index page and I have a link http:/test1.com/directory.php?city=london-greenwich 2. When I click on the link above I'm redirected to directory.php which contain the php file above with the variable $city = $_GET['city']; 3. With this variable $city = $_GET['city']; I should be able to get "london-greenwich" 4. Then I want to add that piece of url "london-greenwich" to $url = "http://www.test2.com/directo
  14. Hi, I'm trying to build a url in the php file below from a url in the browser. URL in the browser: http:/test1.com/directory.php?city=london then I like to get the city and add it at the end of the url in the php file below so it looks like that: http://www.test2.com/directory/london so far I go this but I can only access http://www.test2.com/directory/ <?php$city = $_GET['city'];$fields = array('city' => $city);$url = "http://www.test2.com/directory/". http_build_query($fields, '');?> Thanks for your help,
  15. Hi, I'd like to add a spinner to my ajax call below. <script>var setOffset = 0;var URL = "https://partner-int-api.groupon.com/deals.json";var countryCode = "UK";var token = "&tsToken=UK_AFF_0_201236_212556_0";var categoryFilter = "bars-et-restaurants";var limit = 12;var jsonCallBack = "&callback=jsonp";function calljsonp(offset){var ajaxURL = URL + "?country_code=" + countryCode + token + "&filters=category:" + categoryFilter + "&offset=" + offset + "&limit=" + limit + jsonCallBack;var script = document.createElement("script");script.setAttribute("src", ajaxUR
  16. Found it: data.options[0].redemptionLocations[0].city
  17. I got this error in my JS console: Uncaught TypeError: Cannot read property '0' of undefined when I use: data.redemptionLocations[0].name Here is the doc: https://partner-int-api.groupon.com/help/deal-api Feed: https://partner-int-api.groupon.com/deals.json?country_code=UK&tsToken=IE_AFF_0_201236_212556_0&offset=0&limit=20
  18. Thanks for your reply. I can retrieve the data from some items such as: data.options[0].value.formattedAmount But I still don't understand how to retrieve an array. based on your example, this should works: data.redemptionLocations[0].name but it doesn't
  19. Hi, I can't figure out how to access the followings items: redemptionLocations > name from this feed: https://partner-int-api.groupon.com/deals.json?country_code=uk&tsToken=IE_AFF_0_201236_212556_0&division_id=london&offset=0&limit=20 I have tried: data.options.redemptionLocations[0].namedata.options[0].redemptionLocations.namedata.redemptionLocations[0].name Any suggestions? Many Thanks,
  20. Got it: data.options[0].value.formattedAmount Many thanks for your help!
  21. Thanks for your answer. I've tried the following but I still got some errors: data.value[1].formattedAmount (Uncaught TypeError: Cannot read property '1' of undefined ) data.options.value[1].formattedAmount data.options[2].formattedAmount data.options.value[1].formattedAmount
  22. Hi, I've been using the Groupon API, see feed below. I can access without any problem "+data.highlightsHtml+" but I'm struggling to access some other data such as deals > options > value > formattedAmount I've tried this for example: "+data.options.value.formattedAmount+" but I got the following error: Uncaught TypeError: Cannot read property 'formattedAmount' of undefined So my question is, how can I access formattedAmount from value? URL: https://partner-int-api.groupon.com/deals.json?country_code=uk&tsToken=IE_AFF_0_201236_212556_0&division_id=london&of
  23. ok, I have slice up the URL so now I have a variable for offset. How can I increase offset +10 from a button or link? code: <script>$(document).ready(function() {var URL = "https://partner-int-api.groupon.com/deals.json";var countryCode = "UK";var token = "&tsToken=IE_AFF_0_202176_212556_0";var categoryFilter = "category:food-and-drink";var offset = "0";var limit = "10";var jsonCallBack = "&callback=?";var ajaxURL = URL + "?country_code=" + countryCode + token + "&filters=" + categoryFilter + "&offset=" + offset + "&limit=" + limit + jsonCallBack;$.getJSON(aj
  24. ok great it works, but I had to change the css to: .desc a + * { margin-top:-18px;} Thanks a lot for your help!
×
×
  • Create New...