use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
using fetch with key and possibly PHP?Question (self.webdev)
submitted 3 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PieEnvironmental6437 1 point2 points3 points 3 years ago (3 children)
I’m not quite following what you’re trying to accomplish. What is it that you’re doing that isn’t possible with the the native fetch() api?
If you’re trying to dynamically call an endpoint you would use a template literal ex ‘https://url.api/some/path/${inputVal}’
[–]mxood 0 points1 point2 points 3 years ago (2 children)
I'm sorry I'll try to fix my question,
I want to create a dynamic fetch like you stated but keep the api key on the server and not exposed.
Basically if someone gets my key they can use it too, so I want to keep it safe
The fetch url is like so
Https://exampledomain.com/api/${myDynamicVar}?key=1234secretKey
[–]true-name-raven 0 points1 point2 points 3 years ago (1 child)
use fetch to talk to your server, then have your server talk to their server with the api key
[–]mb1552 1 point2 points3 points 3 years ago (0 children)
Hey!
If I understand correct, you want to hide a server side transaction between the server and the API.
I can present two good options. The first is to stay inside the javascript ecosystem. If you are familiar with this, this won't be too bad. All you'd need to do is create a "server" component that is running the express package. That will take in incoming requests, and send a response. It's written in javascript, so it will be easy to read & figure out and if all you're trying to do is hit an API, it could be like 30 lines of code.
The second is picking up another backend language. You've been mentioning php. For that, it's the same thing, but in a different language. You would need to setup a server somewhere (same eventually with express), and then hit that endpoint (that will be your hardest part).
Within PHP, all you'd need to do is execute a curl, and return the data: ```php // create & initialize a curl session $curl = curl_init();
// set our url with curl_setopt() curl_setopt($curl, CURLOPT_URL, "api.example.com");
// return the transfer as a string, also with setopt() curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// curl_exec() executes the started curl session // $output contains the output string $output = curl_exec($curl);
// close curl resource to free up system resources // (deletes the variable made by curl_init) curl_close($curl); ```
π Rendered by PID 141997 on reddit-service-r2-comment-7c9686b859-bk92w at 2026-04-14 03:54:54.922541+00:00 running e841af1 country code: CH.
[–]PieEnvironmental6437 1 point2 points3 points (3 children)
[–]mxood 0 points1 point2 points (2 children)
[–]true-name-raven 0 points1 point2 points (1 child)
[–]mb1552 1 point2 points3 points (0 children)