Call external API in wordpress based on user input

I want to create a simple wordpress website in which I want to display a search box on a page. On searching a string in text/search box, an external API call should be made based on that string and the data returned by the API should be shown to user. I have successfully referred code from below URL so far – https://rapidapi.com/blog/integrate-external-api-wordpress/.

But I am not able to make a call to API based on string passed in text box. I have done below code so for in the child theme file page:-

<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>     <main id="main" <?php generate_do_element_classes( 'main' ); ?>>         <form action="" method="post">         Enter query:         <input type=text name="t1">         <br>         <br>         <input type=submit name="s">         <?php         /**          * generate_before_main_content hook.          *          * @since 0.1          */         do_action( 'generate_before_main_content' );          if(isset($  _POST['s'])){         echo "good";             $  curl = curl_init();          curl_setopt_array($  curl, [             CURLOPT_URL => "******API URL*****/".$  _POST['t1'],             CURLOPT_RETURNTRANSFER => true,             CURLOPT_FOLLOWLOCATION => true,             CURLOPT_ENCODING => "",             CURLOPT_MAXREDIRS => 10,             CURLOPT_TIMEOUT => 30,             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,             CURLOPT_CUSTOMREQUEST => "GET",             CURLOPT_HTTPHEADER => [                 "x-rapidapi-host: XYZ",                 "x-rapidapi-key: ABc"             ],         ]);          $  response = curl_exec($  curl);         $  err = curl_error($  curl);          curl_close($  curl);          if ($  err) {             echo "cURL Error #:" . $  err;         } else {             echo $  response;         }     }                           /**          * generate_after_main_content hook.          *          * @since 0.1          */         do_action( 'generate_after_main_content' );         ?>         </form>     </main> </div>  <?php /**  * generate_after_primary_content_area hook.  *  * @since 2.0  */ do_action( 'generate_after_primary_content_area' );  generate_construct_sidebars();  get_footer(); 

When I click on Submit button, it gives ‘Page not Found’.

How to set featured image from external url img

I’m generating a thumb of a video and its going to the public_html folder with this

  $  thumbfile = .$  key.".png";   $  videothumb = "/var/www/bamboostock/wp-content/uploads/2021/04/".$  file_name;   $  command = "/usr/bin/ffmpeg -i " . $  videothumb . " -f mjpeg -t 1 -r 1 -y ".$  thumbfile;   system($  command); 

Now I need this image to set as Featured, but nothing is working

Assign wordpress featured images via external URL based on numeric value in custom fields

I have several posts (150) with a custom field ‘floorplan-image-id’ which has a unique value (number) that feeds from XML. The featured image for each post should be automatically assigned via external URL based on the above custom field value.

Example: if floorplan-image-id = 12345 then the Featured image will be : //someurl.com/images/floorplan-1.png

else if floorplan-image-id = 34567 then the Featured image will be : //someurl.com/images/floorplan-2.png

====================

function custom_floorplan-image($ html, $ post_id, $ meta_field) {

$ meta_field = get_post_meta($ post->ID, ‘floorplan-image-id’, true);

if ($  meta_field === '12345') {     $  html = "<img src='"//mysite.com/images/Floorplan_A1.png"'>"; }else if ($  meta_field === '34567') {     $  html = "<img src='"//mysite.com/images/Floorplan_A2.png"'>"; }  return $  html; 

}

add_filter(‘post_thumbnail_html’, ‘custom_floorplan-image’, 10, 3);

How to arbitrarily specify a face of planar graph as an external surface and draw it?

I learned this theorem in the graph theory textbook.

Theorem Every $ 2$ -connected plane graph can be embedded in the plane so that any specified face is the exterior.

G=PlanarGraph[{1 <-> 2, 1 <-> 3, 1 <-> 4, 2 <-> 3,               3 <-> 4, 2 <-> 5, 5 <-> 6, 6 <-> 3},               VertexLabels -> All] 

enter image description here

In the above embedding of this graph, we know $ 1256341$ is boundary exterior face of $ G$ .

I don’t know if there is a way to make the triangle face $ \Delta_{134}$ outside.

The above is just an example. For the graph $ G$ , maybe I can change the layout of some points by VertexCoordinates. But for the large number of vertices, I don’t know if there is a good and unified way to arbitrarily specify an external face and give a good plane drawing.

Portfolio items created indefinitely from external API. Every time different number

I am trying to make new portfolio item for every json item from external api. I am working on WordPress and placed my code in functions.php of the theme used. When i run my code, it creates portfolio items more than necessary. The items seem to randomly get duplicated even tho i have made validation statement and made sure that each post lug is unique. I want it to stop when the array in json file finishes. Unfortunately I can’t share the api link because it is not supposed to be open-source. It consists of one page. $ model and $ results get correct info. I am new to these WP functions and API thing and got really confused at this point. Hope someone can help me out!:

add_action('wp_ajax_nopriv_get_3dmodels_from_api', 'get_3dmodels_from_api'); add_action('wp_ajax_get_3dmodels_from_api', 'get_3dmodels_from_api');  function get_3dmodels_from_api(){          $  results = wp_remote_retrieve_body(wp_remote_get('<api-url-here>',  array(         'timeout'     => 120,         'httpversion' => '1.1',     ) ) );            $  results = json_decode($  results);     //print_r($  results);           foreach($  results->scenes as $  model) {                  $  model_slug = sanitize_title($  model->name. '-' . $  model->id);                  $  existing_model = get_page_by_path($  model_slug, 'OBJECT', 'portfolio');          if ($  existing_model === null) {              $  inserted_model = wp_insert_post([                 'post_name'=> $  model_slug,                 'post_title'=> $  model_slug,                 'post_type'=> 'portfolio',                 'post_status' => 'publish',             ]);                          if (is_wp_error($  inserted_model)) {                 return false;             }                      $  fillable = [                 'field_605dcef7001bc' => 'name',                 'field_605dcf01001bd' => 'description',                 'field_605dcf09001be' => 'category',                 'field_605dcf13001bf' => 'preview',             ];                          foreach($  fillable as $  key => $  name) {                 $  model_content = $  model->$  name;                                  if ($  name == 'preview') {                     $  model_content = '<img src=' . $  model->$  name . '" alt="">';                 }                                  update_field($  key, $  model_content, $  inserted_model);             }         }  wp_remote_post(admin_url ('admin-ajax.php?action=get_3dmodels_from_api'), [         'blocking' => false,         'sslverify' => false,     ]); } 

Thank you!

How does the following script manage to pull data from an external domain without requiring CORS headers?

Script in Question: http://samples.geekality.net/image-fetcher/

You can click "view source" at the bottom to pull up the exact PHP and Javascript being used.

I used part of this script to extract images on a site of mine from another on separate domains and servers. I had to go to the one being scraped and add a CORS header "Access-Control-Allow-Origin" to allow my specific domain to do the AJAX $ .post and actually receive data.

The script above does not require any site to have the CORS header for security. As far as I can tell I’m doing nothing different.

I have an HTML form then I’m grabbing the field data with jQuery and doing a $ .post where the action is a PHP file that uses DomDocument to grab the HTML. The PHP then sorts through the data and echoes a JSON object. Then the jQuery sorts it all out and displays it on the page. Same thing they’re doing.

I can’t see how they’re getting around the need for a "Access-Control-Allow-Origin" header on the site they’re grabbing images from?

Thanks for your time and energy in this!

Do external, non-innate methods exist in Faerûn circa 1489 DR to situationally alter the efficacy of spellcasting?

Prior to D&D5e, Forgotten Realms lore included various situational methods and circumstances that could change the way spells and spellcasting worked. For example, the 1e product Volos’ Guide to All Things Magical includes a lengthy section on the use of various materials as special spell components. Using, say, a star sapphire in the casting of globe of invulnerability would increase level of spells warded off by the globe (see VGtATM p. 51). On the other hand, consuming the herb spellbane detailed in the 2e product Volo’s Guide to Cormyr would entirely suppress spellcasting ability for a period of time (VGtC p. 110).

Faerûn has changed a lot across editions, however, and nowhere is that more true than in the way magic and spells work. Maybe those old methods of amplifying or weakening spells and spellcasting are still effective, or maybe they aren’t. Is there any lore either way in 5e-era publications, i.e., in the Realms as they are post-Second Sundering, circa 1489 DR? Are there any other, different but comparable methods available?

To be clear, I’m interested here in methods that are temporary, ephemeral, and external to the caster and/or target — not innate abilities, learned skills, divine gifts, etc. Magic items are fair game, as are special substances (magical or otherwise). Even locations with special properties that change the way spells function would fit the bill.

Some wordpress plugins doesn’t work so well on external php page outside wordpress?

I am using some php pages (outside wordpress)

The page name :

Test.php in the path (www)

I used

require_once('wp-load.php');  include('wp-config.php'); get_header(); 

The problem is that there are some plugins that doesn’t work probably in these pages, is there anyway to define these pages as a wordpress page ?

Query to polybase external table giving error “Access to the remote server is denied because no login-mapping exists.”

we have successfully created all pre-requisite of creating external tables using SQL Server 2017 Standard Edition CU22 Polybase.

The issue we have is the non-sysadmin login can’t query those external tables .It shows below error.

Msg 7416, Level 16, State 2, Line 29 Access to the remote server is denied because no login-mapping exists.

The sysadmin login can query external tables without any issue. Is there anybody saw this issue and can help to resolve it.

What’s the meaning of “resources external to the SQL Server computer are needed” in Microsoft’s SQL documentation?

In Microsoft’s SQL Server documentation on Windows service account configuration, the decision to use either a VA (virtual account) or a MSA (managed service account) hinges on whether

resources external to the SQL Server computer are needed

What exactly does this phrase mean here? I’m seeking an explanation that makes sense to an ‘accidental DBA’ with minimal experience of SQL Server, or Windows Server, configuration. What counts as a ‘resource’ here, and what kinds of ‘need’ are relevant?

Context: I have a fresh SQL Server 2019 VM on Azure, which was configured with VAs out-of-the-box, and I’m trying to decide whether we need to switch to using MSAs. I have found multiple other questions concerning this same documentation page and/or the same basic decision between VAs or MSAs (or regular AD Accounts) – but none really explain this specific phrase in a way that helps me apply it to my particular scenario. Which is essentially a data warehouse use-case: data will be coming into this SQL instance from external sources, but that’ll be managed by a third-party DW automation application running SSIS scripts, not directly by the SQL engine. (This application has its own AD service accounts.)

Whilst I’ve explained my specific scenario here to try to clarify the question, I’m keen for a generic answer so anyone with any SQL Server use case can evaluate this "resources external to the SQL Server" phrase for their needs. Specific answers for my use case are also welcome.