Jump to content

Search the Community

Showing results for tags 'api'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Ok , there is an issue with the rotten tomatoes API , It gives developers the ability to set a limit of movies to return from the API from a specific category , like the movies in the box office are pulled dynamically, but when I set the limit to 50 , or even 10 movies , it only returns an array containing 3 movies instead of 10 or 50 or whatever the limit of movies is in the API call ... What could be causing that ? is there maybe something wrong with the way I am using the file_get_contents function $box_office_movies = file_get_contents('http://api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json?limit=50&country=us&apikey=[key]',FILE_USE_INCLUDE_PATH); $box_office_movies = json_decode($box_office_movies, true); var_dump($box_office_movies); // returns only 3 movies ..
  2. Sample json query : https://api.datamarket.azure.com/Bing/Search/Web?$format=json&Query=%27Xbox%27 . If you click on the link you are prompted for a username and password. both fields just require you to insert your Bing API. How can I send the password with the query attached? I'm using cURL to send the query. I have tried using the normal method outlined by bing to receive the search results but it doesn't seem to work for me.
  3. I'm just trying to retrieve results using bing API. All I have done so far is copy the example for the bing user manual. https://skydrive.live.com/view.aspx?resid=9C9479871FBFA822%21112&app=Word&authkey=%21ANNnJQREB0kDC04 but I'm getting an error with the scope of the variable. The variable in question is $context Warning: file_get_contents() [function.file-get-contents]: SSL: fatal protocol error in /home/msc2012/12254822/public_html/MetaSearchV1/bing_basic.php on line 35 Service Operation <?php $acctKey = 'xPx9I4rWqBBFRGO4+5aZai7x/KrqSMuM/jLIchClJ6I'; $rootUri = 'https://api.datamarket.azure.com/Bing/Search'; $contents = file_get_contents('index.html'); //contents therefore has basic in it as words? if ($_POST['query']) { $query = urlencode("'{$_POST['query']}'"); $serviceOp = $_POST['service_op']; $requestUri = "$rootUri/$serviceOp?\$format=json&Query=$query"; // Encode the credentials and create the stream context. $auth = base64_encode("$acctKey:$acctKey"); $data = array( 'http' => array( 'request_fulluri' => true, // ignore_errors can help debug – remove for production. This option added in PHP 5.2.10 'ignore_errors' => true, 'header' => "Authorization: Basic $auth") ); $context = stream_context_create($data); // Get the response from Bing. $response = file_get_contents($requestUri, 0, $conext); $jsonObj = json_decode($response); $resultStr = ''; foreach($jsonObj->d->results as $value) { switch ($value->__metadata->type) { case 'WebResult': $resultStr .= "<a href=\"{$value->Url}\">{$value->Title}</a><p>{$value->Description}</p>"; break; case 'ImageResult': $resultStr .= "<h4>{$value->Title} ({$value->Width}x{$value->Height}) " . "{$value->FileSize} bytes)</h4>" . "<a href=\"{$value->MediaUrl}\">" . "<img src=\"{$value->Thumbnail->MediaUrl}\"></a><br />"; break; } } $contents = str_replace('{RESULTS}', $resultStr, $contents); } echo $contents; ?>
  4. Good afternoon, I am able to retrieve results from yahoo with my API key, using the instructions found here: http://developer.yahoo.com/boss/search/boss_api_guide/codeexamples.html# Code: <?php require("OAuth.php"); $cc_key = "your consumer key here"; $cc_secret = "your consumer secret here"; $url = "<http://yboss.yahooapis.com/ysearch/news>,web,images"; $args = array(); $args["q"] = "yahoo"; $args["format"] = "json"; $consumer = new OAuthConsumer($cc_key, $cc_secret); $request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args); $request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL); $url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args)); $ch = curl_init(); $headers = array($request->to_header()); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $rsp = curl_exec($ch); $results = json_decode($rsp); print_r($results); ?> However the output of results is very bizarre, for example, if I search for elephant, I get the following results (partial copy and paste): stdClass Object ( [bossresponse] => stdClass Object ( [responsecode] => 200 [images] => stdClass Object ( [start] => 0 [count] => 35 [totalresults] => 108000 [results] => Array ( [0] => stdClass Object ( [clickurl] => http://0.tqn.com/d/goafrica/1/0/Y/Q/IMG_1592.JPG [size] => 2.2MB [format] => jpeg [height] => 2432 [refererclickurl] => http://goafrica.about.com/od/africanwildlife/ss/The-Big-5-Images-Facts-And-Information-About-Africas-Big-Five_2.htm [refererurl] => http://goafrica.about.com/od/africanwildlife/ss/The-Big-5-Images-Facts-And-Information-About-Africas-Big-Five_2.htm [title] => African Elephant - One of the "Big Five" - African Elephant Image ... [url] => http://0.tqn.com/d/goafrica/1/0/Y/Q/IMG_1592.JPG [width] => 2591 [thumbnailheight] => 150 [thumbnailurl] => http://ts2.mm.bing.net/th?id=H.4700108340594617&pid=15.1&H=150&W=160 [thumbnailwidth] => 160 ) [1] => stdClass Object ( [clickurl] => http://images.nationalgeographic.com/wpf/media-live/photos/000/004/cache/african-elephant_435_600x450.jpg [size] => 54.1KB [format] => jpeg [height] => 450 [refererclickurl] => http://animals.nationalgeographic.com/animals/photos/elephants/ [refererurl] => http://animals.nationalgeographic.com/animals/photos/elephants/ [title] => Elephant Pictures - National Geographic [url] => http://images.nationalgeographic.com/wpf/media-live/photos/000/004/cache/african-elephant_435_600x450.jpg [width] => 600 [thumbnailheight] => 120 [thumbnailurl] => http://ts2.mm.bing.net/th?id=H.5058106677789309&pid=15.1&H=120&W=160 [thumbnailwidth] => 160 ) [2] => stdClass Object ( [clickurl] => http://www.splendidwallpaper.com/wp-content/uploads/2010/03/baby_elephant_1024x768.jpg [size] => 149.4KB [format] => jpeg [height] => 768 [refererclickurl] => http://www.splendidwallpaper.com/baby-elephant-2102/ [refererurl] => http://www.splendidwallpaper.com/baby-elephant-2102/ Please bear in mind that I am very new to php, and programming in general. I am completing a fast track learning course where we don`t have time to learn the basics, we are in the deep end! Does anyone have suggestions on how to display the results properly? Thanks! Note: I had tried to do it this way (which worked with the Google API - although the links were not clickable).. It did not work at all with Yahoo: foreach ($results->{ 'items' } as $item ) { echo $item->{ 'title' }.": ".$item->{ 'link' }."\n\n"; echo $newline; }
  5. Hi guys I'm happy to be a member of this forum i am wondering if there is a way to get new notifications using Twitter API this exists in facebook (i use facebook-sdk) , Twitter has some libraries for that too , but i can't find anyone that can get Twitter new notifications so any suggestions ? and does twitter work like facebook ? i mean does it have notifications too ? because i don't use it at all thanks
  6. I would like to be able to login to facebook without being there so I can post to facebook from rss files and a database. I can retrieve the access token using curl and I can see the feed. I want to able to post messages using either the api or better still using curl
  7. I've downloaded the PHP client library for Google Adwords API. I need to insert my login details in/src/Google/Api/Ads/AdWords/auth.ini. One of the variable is developerToken . It is said here: https://developers.google.com/adwords/api/docs/signingup that in order to get this variable, you need to log into the MCC, and Navigate to My Account -> AdWords API Center. But I don't see the link to "Adwords API Center" under "My Account". Can someone help me please to get the API access? Thanks in advance
  8. hi guys, I'm searching for a CMS that doesn't break his API too often and when it does it must be done without the need to restart from scratch(like Drupal ) I really like the stability of the wordpress API and I'm searching for a CMS that have some API stability too. It's not that wordpress is bad, it's just too popular and because of that it's a big target for hackers. Do you have some recommendations? Thank's for your time and have a good day
  9. I am trying to build a SOAP call in php which should make a request to a c#/asp.net based API. The request is in the format of an XML. *XML contains Arabic Characters. If the XML contains only English Characters everything works fine. I also tried to hit the Webservice endpoint via a SOAPUI with Arabic characters and it works fine.So it confirms that the system accepts Soap calls with Arabic Characters. The code I use to hit the EndPoint is shown below. $soapvar = new SoapVar($retrieveXYZRequest, XSD_ANYXML); $this->client->__soapCall('RetrieveXYZ',array($soapvar)); $retrieveXYZRequest is the SOAP Request built in the form of Text(with Arabic characters in certain elements). RetrieveXYZ is the method name that should be called. Any kind of input will be much appreciated.
  10. I'm working through some code to display a tumblr blog on a website. Each of Tumblr's post types are easy enough to get to... <ul id="reblog"> <? foreach ($xml->posts->post as $post) { ?> <li> <? // REGULAR POSTS if ($post['type'] == "regular" ){ echo "This is a regular post"; } // PHOTO POSTS if ($post['type'] == "photo" ){ echo "This is a photo post"; } // LINK POSTS if ($post['type'] == "link" ){ echo "This is a link post"; } // AUDIO POSTS if ($post['type'] == "audio" ){ echo "This is an audio post"; } ?> </li> <? } ?> </ul> What I'm trying to do is to check and see if certain tags are used on a post, and the based on that I'll be formatting the entry a little different. I can list all of the tags, but I'm stumped on how to check the existence of a certain tag in $post->{'tag'} $xml = simplexml_load_file('http://applesold.com/assets/cache/tumblrposts.txt'); <ul id="reblog"> <? foreach ($xml->posts->post as $post) { ?> <li> <? // REGULAR POSTS if ($post['type'] == "regular" ){ echo "type of post: regular<br>"; // THIS DOESN'T WORK -- if ($post->{'tag'} == "infographic") { echo "INFOGRAPHIC"; } else { echo "non-INFOGRAPHIC"; } } ?> </li> <? } ?> </ul>
  11. I am trying to include the latest post from a tumblr blog in my website, which works fine. I can't figure out how to choose a specific size of photo from the API, such as the 500px photo. <?php $numPosts = 3; $feedURL = "http://jeffhui.tumblr.com/api/read/?num=$numPosts"; $xml = simplexml_load_file($feedURL); foreach($xml->posts->post as $post){ $title = (string) $post->{'regular-title'}; $posts = (string) $post->{'regular-body'}; $photo = (string) $post->{'photo-url'}; $caption = (string) $post->{'photo-caption'}; echo"<h2>".$title."</h2> <p>".$posts."</p> <p><img src=".$photo."></p> <p>".$caption."</p>"; } ?> Some one posted this online and say it has to loop through them like this, but I dont know how to apply the bellow script into my. <?php $xmlResult = file_get_contents($tumblr_url_aktuell); $xml = simplexml_load_file($tumblr_url_aktuell); foreach($xml->posts->post->{'photo-url'} as $photoURL){ if((string)$photoURL['max-width'] == '500'){ $image = $photoURL; } } ?>
  12. I have been doing PHP for a while and am able to do e-commerce and CMS with coding; however, I can't quite figure this issue out right now. I am currently working on a project that will allow people to text photos and information to a website and have the text saved into a database that can then show up on the webpage when someone views it. I know how to get the text information by using APIs but can not figure out how to save it into a MySQL Database! If you have any ideas I would appreciate the help.
  13. Hi PHP expert, I am trying to read the post date from my tumblr api with the following code. $date = $xml->posts->post ['date']; echo '<p>'.$date.'</p>'; This is what I get from the above code "Wed, 21 Nov 2012 13:32:00" My question is, are there anyways I can get the date with out the hour, min and seconds? for example "Wed,21 Nov 2012"?
  14. Hello everyone, Hope we all had a great NYE and Christmas . Anyway - I'm seriously stuck - yet motivated to get an API on my site. I am hoping a few of you can point me in the right direction based on my issues listed below. I've tried to provide as much information as possible so you can see what I have tried and where I am comming from . As a side note - any section I have doubts about what I am saying I have also put a ? next to the heading or text. And please do correct me if I an wrong anywhere. Background I am attempting to make a PHP based RESTful API hosted on https://api.mydomain.com/1.0/ which would interact with a mySQL database and/or file storage. The API once out of BETA would power the service itself - much like Twitter and be accessible externally through oAuth 2.0 connections. Initially I wish to only support JSON and not XML. PHP MySQL JSON oAuth 2.0 References These are the existing APIs I have been using as references when deciding how to construct the calls for my API. http://developer.linkedin.com/apis https://dev.twitter.com/ https://developers.f.../reference/api/ oAUth Library I will be using one of these two oAuth libraries: https://github.com/fkooman/php-oauth https://github.com/b...uth2-server-php RESTful Operations as CRUD From my understanding I have four HTTP methods at my disposal whic translate something like this (HTTP = CRUD = SQL): POST = CREATE = INSERT GET = READ = SELECT PUT = UPDATE (Modify) = UPDATE DELETE = DELETE = DELETE Example URL(s)/URI(s) So these are a few example calls I want to be able to make to test and trial this: https://api.mydomain.com/1.0/me (NB: me = current logged in user/user authenticated through oAuth) POST = ? GET = Get informaiton on current user, such as full name, age, etc PUT = Update information on current user, such as full name, age, etc DELETE = Delete current user https://api.mydomain.com/1.0/johndoe POST = Create a new user 'johndoe' ? GET = This would return data on a specific user - in this case 'johndoe'. PUT = ? DELETE = ? https://api.mydomain...es/254855781571 (NB: Every file uploaded is given a unique number and this number is stored in a mySQL database which stores information against the file such permissions and a log of access.) POST = Upload file GET = Get file and display or download PUT = Change permisisons DELETE = Delete file Sample of https://api.mydomain.com/1.0/me So this is a sample of output from /me Much like Facebook does now I wish to use 'fields' to refine and join queries. Sample of https://api.mydomain...e?fields=groups So this is a sample of output from /me I understand that 'fields' could be acieved through https://api.mydomain.com/1.0/me/groups but this would not allow me todo https://api.mydomain...s=groups,gender I hope and intend to support both https://api.mydomain.com/1.0/me/groups and https://api.mydomain...s=groups,gender style calls. Detecting (Capture) RESTful Operations Server-Side ? The next few sections are broken down a fair bit in seperate headings. Obviously on the server-side (https://api.mydomain.com/1.0/) I need a file at index.php which handles/captures the calls made to the URL. Now my understanding is that the oAuth library will generate and managed the 'access token'. Further my site (internally) should be able to use any API call without an 'access token' or will it need one itself? So, anyway, start from the beginning . What does the code look like the captures the calls made? And how does it handle the 'access token' in terms of knowing it needs one or not. So as far as I can gather part of the code would need to determine the functuion (me, johndoe, etc) then the action (CRUD) and the informaiton that goes with it if needed by certain CRUD functions. How would that code then process the function etc? What code do I write to return user info etc as per the examples in the sections above? Making the Call - Client/Developer Side ? Finally what code does a developer use to call the API and get the data in a $variable as json. Again always assuming PHP. End As you can see I have tried to put a fair bit of thought and work into the post in a bid to show what i do understand and get some structured answers to help me out. But if anything makes nosense or needs clarification please ask and I'll do my best to clarify what I have written. More specific questions on how to do the 'fields' may follow later if I cannot figure it out. Thanks guys and gals. I'm off to implement one of those oAuth libraries now AussieRhods
  15. Hi, I have an API script provided to people fetching data from my website. Other than stats information, how can I get to know that which websites are connecting my website's API? Any php function that I can include in my API script to get their domain names then insert into my database? I am php newbie. It would be appreciated if you can post your complete function codes here. Thanks, Richard
  16. i'm building a little apllication , it's a nusic videoclip streaming service ,i have my database setup , i have my videobackend setup also , but i have an API that i suppose to use to be able to retrieve a video base on an unique id when i click on an anchor tag . I'm new with PHP, i'm buildling this just to be able to do something with all the knowledge i accumulate an example of the website . also here a link of the API .. i just need some help to finish the integration. thanks.
  17. im working with instagrams api and im not sure what to do next ... i so far have there access_token , but i dont know how to get the rest of the users information. the code below is given to me by instagram to retrieve the users information but i dont know what language to use it with , i have tried php but i dont know what to do with it ? please help thank you i have the access token , client id , client secret , and redirect uri. but do i change the CODE to a variable for the token ? curl \-F 'client_id=CLIENT-ID' \ -F 'client_secret=CLIENT-SECRET' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=YOUR-REDIRECT-URI' \ -F 'code=CODE' \https://api.instagram.com/oauth/access_token
  18. phphelpme

    Help

    alright , do you know how to get the section from the url , the token part and turn that into a variable ? example would be like this they instert the url here <form action="list.php" method="post"> <input name="token" type="text" style="width:200px;"/> <input type="submit" class="btn btn btn-info btn-mini" value="Login" /> </form> and then on list.php it seperates the token and makes it a variable the url looks like this http://localhost/instalike/code.php#access_token=263222910.4d15ef2.0b42098ba3b845b9940af5b46i just need the access_token i just need the access_token each access token will be different
  19. Howdy, I just started experimenting with Goutte - found here on Github: https://github.com/f...ore-information I followed the examples almost exactly but here is my code anyways: <?php require_once 'goutte.phar'; use Goutte\Client; $client = new Client(); $crawler = $client->request('GET','http://www.cnn.com/'); $nodes = $crawler->filter('.error_list'); if ($nodes->count()) { // die(sprintf("Authentication error: %s\n", $nodes->text())); } // This part of the code I havent even changed yet being I can't get passed this problem :/ printf("Nb tasks: %d\n", $crawler->filter('nb_tasks')->text()); ?> Here is what is displayed on the page when running the php code: ????????G?? Fatal error: Class 'Goutte\Client' not found in /Applications/XAMPP/xamppfiles/htdocs/scrape.php on line 7. I have used PHP in the past but im a bit rusty, my apologies if it is something simple. I checked the Github issues and their doesn't appear to be any issues related to the problem I am currently having. I have the goutte.phar file in the same directory as the file with the code above so I am unsure why the fatal error is occurring on not finding the Client class? Thanks for the help!
  20. I have a company that needs php tweaking. (My previous programmer couldn't be found anymore) The client e-mailed me this "Basically what we need is for you to provide us with an http rest API where we will provide the tracking code and in return you will return to us a JSON object with the status of the delivery As an example: TRACKING CODE: ABCDEFGHIJ URL: http://mydomain.com/track.php?code=ABCDEFGHIJ METHOD: GET RESPONSE: {"status":2} where 2 is the code for the status shipment which is defined by 1 - GOOD 2 - BETTER 3 - BEST" How and where do I place this? What's "HTTP REST API" and "return to us a JSON object" It's all gibberish to me! Some web guru answer me pls? Thanks in advance!
  21. I have a site that fetches reviews on various renowned car dealers (i.e. Fordham Toyota, Westchester Toyota, Toyota Of Manhattan etc.) from major review sites like CitySeach, Dealer Rater, Insider Pages etc. Basically the functionality of this site is to allow business owners to monitor their online reviews on major review sites. Additionally, the site also pulls comments from Facebook and twitter (based on keywords) and also displays Google Alerts. Presently I am using Google Place Details API into my site to show business reviews from Google+. The API is working but it doesn't meet my requirement. It fetches five reviews in JSON format but I don't think those five reviews are latest reviews. I am using a server side call like: https://maps.googlea...ensor=true&key=MY_API_KEY Is there any way to fetch 5 latest reviews using this API ? Thank You.
  22. <?php function mtgox_query($path, array $req = array()) { // API settings $key = '7583cda31885'; $secret = ''; // generate a nonce as microtime, with as-string handling to avoid problems with 32bits systems $mt = explode(' ', microtime()); $req['nonce'] = $mt[1].substr($mt[0], 2, 6); // generate the POST data string $post_data = http_build_query($req, '', '&'); // generate the extra headers $headers = array( 'Rest-Key: '.$key, 'Rest-Sign: '.base64_encode(hash_hmac('sha512', $post_data, base64_decode($secret), true)), ); // our curl handle (initialize if required) static $ch = null; if (is_null($ch)) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } curl_setopt($ch, CURLOPT_URL, 'https://mtgox.com/api/'.$path); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // run the query $res = curl_exec($ch); if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch)); $dec = json_decode($res, true); if (!$dec) throw new Exception('Invalid data received, please make sure connection is working and requested API exists'); return $dec; } // example 1: get infos about the account, plus the list of rights we have access to //var_dump(mtgox_query('0/info.php')); // old api (get funds) var_dump(mtgox_query('0/getFunds.php')); // trade example // var_dump(mtgox_query('0/buyBTC.php', array('amount' => 1, 'price' => 15)));\ ?> OutPut : array(2) { ["usds"]=> string( "37.94073" ["btcs"]=> string(10) "6.44987703" } How do I maek 'usds' and 'btcs' into variables so I can echo $usds; Thank you so much for the help!
  23. I have code where I'm simply calling an API and I've converted it to loop the call so that I can call it with three different argument values. This is because the API is structured where it can accept one value for that argument at a time, but I need to compare the results of the three calls and I think the best way is to build a single array from the responses by either pushing a value if it exists or pushing the whole index if not. Think of it like the API response can give me data that can be as much as 400 products that are sold across 3 stores. All 400 may be sold in one store, but maybe only 120 in another and 100 in the third. I need my array to be all 400 products but I'll want to have an array within that holds the stores for the given product. Code: $IdentifierTest = 1472; $arguments = ['store 1', 'store 2', 'store 3']; $TestApi = app(TestApi::class); $newArray = array(); foreach($arguments as $argument){ $testResponse = $TestApi->getData($IdentifierTest, $argument); $Data = $testResponse->getResult()->getData(); // get the final results of call //check if array empty, and if so, push all records // if not empty, start checking 'id' against existing array records. If match, push stores. If not, add record to array } $this->makeFile($IdentifierTest, $Data); An example of the response is: array:426 [▼ 0 => prices {#2698 ▼ #container: array:11 [▼ "prd" => 2380 "id" => "173489" "price" => "65.00" ] } The issue is that specific example only shows up when calling the API with 'store 1' and 'store 2' as the argument, but not 'store 3'. What I'd like to do is call the API with each argument and create a new array with a ```stores``` index that pushes the store number if the id exists in the call, like so: array:426 [▼ 0 => prices {#2698 ▼ #container: array:11 [▼ "prd" => 2380 "id" => "173489" "price" => "65.00" stores: array[ 'store 1', 'store 2' ] ] } So when it's called with 'store 1' I would push the response into an array with 'store 1' as the value in 'stores', then on 'store 2' I would take the response and first check to see if the id exists in the array I've made. If it exists, I'll add 'store 2' to the 'stores' and if not I'll make a new index in the array. Basically, if product (id) 178293 is sold in all three stores then that means it would come back in all 3 API response calls and would end up being a single record in this new array with ```stores['store 1', 'store 2', 'store 3']``` How can I create a new array from this where I push only the stores if the id exists in the API call while keeping the current structure?
×
×
  • 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.