Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,148
» Latest member: Marlo
» Forum threads: 21,799
» Forum posts: 22,672

Full Statistics

Online Users
There are currently 747 online users.
» 0 Member(s) | 741 Guest(s)
Applebot, Baidu, Bing, DuckDuckGo, Google, Yandex

 
  [Oracle Blog] The Advanced Management Console (AMC) 2.17 release is now available!
Posted by: xSicKxBot - 05-08-2022, 11:37 AM - Forum: Java Language, JVM, and the JRE - No Replies

The Advanced Management Console (AMC) 2.17 release is now available!

AMC 2.17 offers system administrators greater and easier control in managing Java version compatibility and security updates for desktops within their enterprise and for ISVs with Java-based applications and solutions. Key Benefits Key benefits of using AMC include: Usage Tracking: The Advanced Mana...

https://blogs.oracle.com/java/post/the-a...-available

Print this item

  [Tut] 5 Easy Ways to List Imported Modules in Python
Posted by: xSicKxBot - 05-08-2022, 11:37 AM - Forum: Python - No Replies

5 Easy Ways to List Imported Modules in Python

5/5 – (1 vote)

Problem Formulation and Solution Overview


In this article, you’ll learn how to display the imported modules in Python.

As a Python Coder, you will encounter times when you need to view a list of all imported modules possessing a global or local scope. This article answers the question below.

? Question: How would we write Python code to display the imported modules?

We can accomplish this task by one of the following options:


Method 1: Use pip freeze


This method displays a list of all imported global module names and versions sorted, by default, in alphabetical order.

pip freeze

Navigate to the terminal window from an IDE and enter the above command. Then, hit the <Enter> key to execute. The output is sent to the terminal.

? Note: Your prompt may be different from the example shown above.




Output (snippet)

Your imported global module names and versions may differ from that shown below.


absl-py==1.0.0
anyio==3.5.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arrow==1.2.2
asttokens==2.0.5
astunparse==1.6.3
attrs==18.2.0
Babel==2.10.1
backcall==0.2.0
beautifulsoup4==4.10.0
...
zope.interface==5.4.0]


Method 2: Use List Comprehension


This example uses the sys library with List Comprenehsion to return all imported local module names, by default, in an unsorted list.

import sys
results = [m.__name__ for m in sys.modules.values() if m]
results = sorted(results)
print(results)

This code loops through sys.modules.values() using __name__ (aka a dunder) and determines if the item is a locally scoped module. If so, the module name saves to results.

This code sorts the results variable and saves it back to itself for readability. These results are output to the terminal in list format.




Output (snippet)

Your imported local module names may differ from that shown below.


['main', '_abc', '_codecs', '_collections', '_distutils_hack', '_functools', '_imp', '_operator', '_signal', '_sitebuiltins', '_stat', '_thread', '_warnings', '_weakref', 'abc',...'zope']


Method 3: Use dir()


This example uses the dir() function to return all local module names in a sorted list format.

modules = dir()
print(modules)

The output below confirms this script displays only the names that apply to our local scope.




Output (snippet)

Your imported local module names may differ from that shown below.


['annotations', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec']


Method 4: Use inspect.getmember() and a Lambda


This example uses inspect.getmember() and a Lambda to return the imported local modules in a sorted format.

import inspect
import os
m = inspect.getmembers(os)
res = filter(lambda x: inspect.ismodule(x[1]), m) for r in res: print®

This code returns the names of the imported local modules and their location on the system as an iterable object. A for the loop is used to iterate through this and output one/line.




Output


('abc', <module 'abc' from 'C:\\mypythoninstall\\lib\\abc.py'>)
('path', <module 'ntpath' from 'C:\\mypythoninstall\\lib\\ntpath.py'>)
('st', <module 'stat' from 'C:\\mypythoninstall\\lib\\stat.py'>)
('sys', <module 'sys' from 'C:\\mypythoninstall\\lib\\sys.py'>)


Bonus: Count Modules


If you want to determine the total number of imported modules, use the dir() and len() functions.

count = dir()
print(len(count))

This code references the imported local modules and uses len() to determine how many are imported. The output is sent to the terminal.

Output

Your count may differ from the output below.


11


Summary

These four (4) methods to list imported modules should give you enough information to select the best one for your coding requirements.

Good Luck & Happy Coding!




https://www.sickgaming.net/blog/2022/05/...in-python/

Print this item

  (Indie Deal) Donuts Call Bundle, Star Wars Flash Sale & Giveaways
Posted by: xSicKxBot - 05-08-2022, 11:37 AM - Forum: Deals or Specials - No Replies

Donuts Call Bundle, Star Wars Flash Sale & Giveaways

Donuts Call Bundle | 6 Steam Games | 93% OFF
[www.indiegala.com]
Want to fill the donut hole in your mundane life? We hear you and are answering the call with 6 Steam Games at 93% OFF in one whole bundle.

May the 4th be with you: Star Wars Sales and Giveaways
[www.indiegala.com]
[www.indiegala.com]
https://www.youtube.com/watch?v=aQjOebmf2ug
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...6759892384

Print this item

  PC - MotoGP 22
Posted by: xSicKxBot - 05-08-2022, 11:36 AM - Forum: New Game Releases - No Replies

MotoGP 22



Explore all the contents of the 2022 season in the MotoGP™ classes and in all the other categories. More than 120 riders, over 20 official circuits and all the excitement of the official championship are waiting for you. And if you want to take a leap into the past, over 70 historic champions will let you relive the best of MotoGP™ history.

Publisher: Milestone S.r.l

Release Date: Apr 21, 2022




https://www.metacritic.com/game/pc/motogp-22

Print this item

  News - Not-E3 2022 Press Conference Schedule
Posted by: xSicKxBot - 05-08-2022, 11:36 AM - Forum: Lounge - No Replies

Not-E3 2022 Press Conference Schedule

After an all-digital event last year, E3 2022 has been officially canceled, but that doesn't actually mean all that much when it comes to major game publishers holding press conferences. For viewers at home, things, may not even look all that different, with lots of digital game announcement events happening in mid-June, building hype and excitement for the rest of the year and beyond. So far, we know about big events like the Xbox & Bethesda show as well as the Summer Games Fest show. With all these different events happening independently of E3, however, it could be a little tough to keep track of them all, so we've organized every announced not-E3 event into a handy schedule here. As more events are announced, we'll continue to update this post.

  • Summer Game Fest Live: June 9
  • Xbox & Bethesda Games Showcase: June 12

June 9

Summer Game Fest Live

Geoff Keighley's Summer Game Fest extravaganza kicks off this year on June 9 with the Summer Game Fest Live presentation. This will take place at 11 AM PT (more timezones below) and will feature new game announcements. Keighley called the event a "cross-industry showcase," so expect announcements from a wide range of companies, and it will also feature the latest iteration of Day of the Devs.

  • 11 AM PT
  • 1 PM CT
  • 2 PM ET
  • 7 PM GMT

Additionally, select IMAX theaters will be hosting watch parties for the Summer Game Fest event--and later this year, will also do the same for The Game Awards 2022.

Continue Reading at GameSpot

https://www.gamespot.com/articles/not-e3...01-10abi2f

Print this item

  [Oracle Blog] Java SE 14.0.1, 11.0.7, 8u251 and 7u261 Have Been Released!
Posted by: xSicKxBot - 05-07-2022, 02:09 AM - Forum: Java Language, JVM, and the JRE - No Replies

Java SE 14.0.1, 11.0.7, 8u251 and 7u261 Have Been Released!

The Java SE 14.0.1, 11.0.7, 8u251 and 7u261 update releases are now available. You can download the latest JDK releases from the Java SE Downloads page. OpenJDK 14.0.1 is available on http://jdk.java.net/14/. New Features, Changes, and Notable Bug Fixes For information about the new features, change...

https://blogs.oracle.com/java/post/java-...n-released

Print this item

  [Tut] Can a Miner Change a Bitcoin Transaction?
Posted by: xSicKxBot - 05-07-2022, 02:09 AM - Forum: Python - No Replies

Can a Miner Change a Bitcoin Transaction?

Rate this post

You should always apply your own critical thinking when it comes to the crypto space. One question asked by many critical thinkers who know the overall idea of the Bitcoin protocol but not yet its technicalities is:

? Question: What if a miner is not trustworthy and tries to change my transaction?

  • Can the miner replace the receiver address with its own?
  • Can the miner change the transaction amount?
  • Can the miner change the sender address?

The answer to all those questions is: No. Because if you want to issue a transaction, you need to broadcast the information

(sender_public_key, receiver_public_key, amount)

But here’s the trick: you sign the transaction using the private key of the sender:

sender_private_key --> sign(sender_public_key, receiver_public_key, amount)

Everybody knows the public key of the sender because it’s included in the transaction and therefore in the block.

Knowing the public key of the sender, anybody can verify that the whole transaction was signed by the owner of the private key.

If you changed one thing in the transaction (even by 1 SAT), the signature would not fit the transaction anymore and everybody would be able to know it!

? Info: With public-key cryptography, robust authentication is possible. A sender can combine a message with a private key to create a short digital signature on the message. Anyone with the sender’s corresponding public key can combine that message with a claimed digital signature. If the signature matches the message, the origin of the message is verified because it must have been made by the owner of the corresponding private key. (Modified from Wikipedia)

Now, what would happen if the miner would change any of the following information?

  • sender_public_key,
  • receiver_public_key,
  • amount,

Well, the signature would not match the changed transaction, so there are two possibilities for a malicious miner:

  • The miner would now have to include the original signature in the block which would not match the changed data. Any other miner would quickly see that the transaction is invalid and reject the block from the malicious miner. Remember: the assumption is that a majority of the mining power behaves properly in the Bitcoin protocol!
  • The miner would have to calculate a new signature that fits to the changed transaction data. However, this is not possible as they don’t know the private key of the sender!

The following video does a great job explaining these details in Bitcoin:




There are some details to it that I abstracted away. For example, miners do not actually check if a transaction is valid—that’s what full nodes are here for:


ALL full nodes verify all transactions in all blocks that they receive (as well as transactions received outside of blocks). Just because a block has a valid proof of work does not mean that the block is valid. It must still build upon a valid block and must only contain valid transactions. Full nodes still verify that transactions contained within a block are valid.

Contrary to popular belief, miners do not say what transactions are valid. Their job is to determine the order of transactions, within certain constraints. It is the job of full nodes to verify transactions, and all miners (or the mining pools) should be running full nodes.

(StackOverflow)




https://www.sickgaming.net/blog/2022/05/...ansaction/

Print this item

  [Tut] PHP CURL Post and Get request with example
Posted by: xSicKxBot - 05-07-2022, 02:09 AM - Forum: PHP Development - No Replies

PHP CURL Post and Get request with example

by Vincy. Last modified on May 6th, 2022.

PHP cURL is a library that allows clients to access a remote server via a URL. It sends HTTP requests to the endpoint from a different application or component.

It allows inter-application hits to get a response over the network. This mechanism is useful to work with PHP RESTful services, API interactions, and etc.

There are many use case scenarios where PHP cURL post is exactly suited. For example,

  1. Extracting content from a webpage.
  2. Preparing feed from external sources.
  3. SDK-free API’s direct access methods.

This quick example gives a straightforward code to implement a PHP cURL post.

Quick example



<?php
$postParameter = array( 'name' => 'Jane', 'dateOfBirth' => '1974-8-17'
); $curlHandle = curl_init('http://domain-name/endpoint-path');
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $postParameter);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); $curlResponse = curl_exec($curlHandle);
curl_close($curlHandle);

Apart from this, we will see more use case examples of PHP cURL post requests in the upcoming sections.

Part 1 – Basics of PHP cURL


The following are the steps to perform a basic PHP cURL request-response cycle.

  • Initialize cURL session.
  • Set cURL options.
  • Execute request.
  • Close session.

How to configure PHP cURL?


PHP contains libcurl library to let the environment work with cURL. This library will be enabled by default.

If not, do the following steps to enable PHP cURL module in your environment.

  1. Open PHP configuration file php.ini
  2. Check for the extension=php_curl.dll initiation.
  3. Remove the semicolon (;) at the beginning of the above line.
  4. Restart the Apache server.

Set PHP cURL POST requests – Alternate methods


There are many ways to send PHP cURL post parameters.

  1. JSON format.
  2. HTTP query string.
  3. POST array format.

JSON format:

 <?php curl_setopt($ch, CURLOPT_POSTFIELDS, "{key1:value1,key2:value2}");
?>

HTTP query string:

 <?php curl_setopt($ch, CURLOPT_POSTFIELDS, "key1=value1&key2=value2"); ?>

PHP cURL POST array format

The CURLOPT_POSTFIELDS may have a PHP array to pass the parameters to the endpoint.

 <?php curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'); curl_setopt($ch, CURLOPT_POSTFIELDS, array("key1"=>"value1", "key2"=>"value2"); ?>

Set cURL header options


To set PHP cURL header, the CURLOPT_HTTPHEADER constant is used. A cURL header can have more information. The following keys are some of the examples to add PHP cURL header options.

  • Accept-Encoding
  • Cache-Control
  • Host
  • Content-Type
  • Accept-Language
  • User-Agent

This program sets the cURL header options to set the content type. There are options to send custom headers also. It is to send non-standard key-value pairs. Use prefix X- to send non-standard headers. Example,


curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'X-key: value'
));

The CURLOPT_HEADER constant is set with boolean true. It is for allowing the header information attached with the return response.


<?php
$url = "http://domain-name/endpoint-path"; $curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array( "X-Custom-Header: header-value", "Content-Type: application/json"
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_HEADER, true);
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Part 2 – Example use cases


With some basic knowledge, it will be easy to understand the following examples. It deals with some of the use case scenarios of PHP cURL post or get request methods.

HTTP POST form data


PHP cURL allows posting parameters to the server. It uses any one of the methods we discussed earlier to post parameters via cURL.

The following cURL script shows how to post an array to an endpoint URL. The CURLOPT_POST and the CURLOPT_POSTFIELDS are to send the values via PHP cURL post.


<?php
$url = 'http://domain-name/endpoint-path'; $curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $data = "name=jane&age=23"; curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $result = curl_exec($curl);
curl_close($curl);
?>

PHP cURL POST to upload file


It is also possible to upload files to the server via PHP cURL post. The below code shows how to upload an image file to the server.

It prepares the object with the file data. It uses PHP curl_file_create() function to prepare the file post content.

By sending the ‘fileParam’ bundle in this way, the endpoint code can access it via $_FILES[] array.


<?php
$url = 'https://domain-name/path-to-endpoint/php-curl-post-file-endpoint.php'; if (function_exists('curl_file_create')) { $fileContent = curl_file_create("cherry.jpeg", 'image/jpeg');
} else { $fileContent = '@' . realpath("cherry.jpeg", 'image/jpeg');
} $data = array('fileParam'=> $fileContent); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST,true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$result=curl_exec ($curl);
curl_close ($curl); print $result;
?>

Put the following endpoint code in the server. Then hit the endpoint via the above cURL script. The PHP curl post request sends the file input to this endpoint. This PHP code accesses the uploaded file from the $_FILES array.

php-curl-post-file-endpoint.php


<?php
$targetDir = 'uploads';
if ($_FILES["fileParam"]["tmp_name"] != "") { $tmp_name = $_FILES["fileParam"]["tmp_name"]; // basename() may prevent filesystem traversal attacks; // further validation/sanitation of the filename may be appropriate $name = basename($_FILES["fileParam"]["name"]); if(move_uploaded_file($tmp_name, $targetDir . "/" . $name)) { print "Image uploaded."; } else { print "Image upload failed."; } }
?>

HTTP GET request to grab a webpage


In the cURL request, the default method is GET. This program calls the server via cURL with the default GET request method.

Unlike PHP cURL POST, it sends data as the query string. To pass parameters to a GET request, it should be built as part of the URL.

It grabs the HTML of the website specified as the cURL endpoint. It prints the response and renders the target website’s HTML in the browser.


<?php
$url = 'http://domain-name/endpoint-path'; $curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl);
curl_close($curl);
print $response;

Grab website HTML via cURL and write to a file


Instead of printing the website layout to the browser, it can also be written into a file.

This code creates a filehandle and writes the cURL HTML response into a file. It uses the file handle as the reference.

It will be useful if you want to download and save the website HTML into the server permanently.


<?php
$url = 'http://domain-name/endpoint-path';
$file = fopen("site-content.html", "w"); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_FILE, $file); curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false); curl_exec($curl);
curl_close($curl);
fclose($file);

The PHP file_get_contents() function is also used to grab the content of the target URL.

But, the server configuration should allow reading the content by using this method.

PHP CURL post and receive JSON data


This example shows how to send a PHP cURL post in JSON format. It also receives the cURL response in the format of JSON.

This code guides creating API services to get requests and send responses in JSON format.


<?php
$url = 'https://domain-name/path/php-curl-post-endpoint-json.php';
$data = array( "first_name" => "Jane", "last_name" => "Mclane", "email" => "jane_mc@gmail.com", "addresses" => array( "address1" => "21/A", "city" => "Los Angels", "country" => "USA", "phone" => "555-1212", "pincode" => "82312" )
);
$encodedData = json_encode($data);
$curl = curl_init($url);
$data_string = urlencode(json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedData);
$result = curl_exec($curl);
curl_close($curl);
print $result;

This code prepares the JSON response by setting the content-type using PHP header(). It sets the application/json as the content type.

php-curl-post-endpoint-json.php


<?php
header("Content-Type:application/json");
$data = file_get_contents('php://input');
print $data;

Handle redirects (HTTP 301,302)


The CURLOPT_FOLLOWLOCATION is set to true to perform the 3XX redirect via PHP cURL.

During the redirect, the cURL will send a GET request on successive redirects. To change this, the CURLOPT_POSTREDIR has to be set.

This program sets CURL_REDIR_POST_ALL to send PHP cURL POST requests on successive attempts.

It limits the number of redirects by using the CURLOPT_MAXREDIRS constant.


<?php
$url = 'http://domain/path';
$data = array( "first_name" => "Jane", "last_name" => "Mclane"
);
$encodedData = json_encode($data);
$curl = curl_init($url);
$data_string = urlencode(json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedData); curl_setopt($curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl,CURLOPT_MAXREDIRS, 3);
$result = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
print "<PRE>";
print_r($info);
print_r($result);

This program will return more information as shown below.

  • Redirects count.
  • Time to redirect.
  • A header with the 3XX status.

php curl post 3xx redirect

Writing cURL error logs into a file


Keeping logs is a best practice for audit purposes. When the site is live, sometimes the logs are very useful for debugging also.

Since it is a remote call, logging cURL errors into a file will help to analyze and fix the issue.

This code guides how to log the error that occurred during the PHP cURL post. It uses PHP curl_error() function to


<?php
$logFileHandle = fopen("log/curl-error-log.txt", 'a+');
$curl = curl_init("http://domain_name/path");
if(curl_exec($curl) === false)
{ $date = date("m/d/Y"); $errorMessage = curl_error($curl); $curlError = $date . ' Error: ' . $errorMessage . "\n\n";
}
curl_close($curl);
fwrite($logFileHandle, $curlError);
fclose($logFileHandle);

Write cURL log using CURLOPT_STDERR constant


There is an alternate method to log the PHP cURL error into a file. The CURLOPT_STDERR writes the error message with the reference of the file handle.


<?php
$logFileHandle = fopen("log/curl-error-log.txt", 'a+');
$curl = curl_init("http://domain_name/path");
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_FILE, $logFileHandle);
curl_setopt($curl, CURLOPT_STDERR, $logFileHandle);
curl_exec($curl);
curl_close($curl);
fclose($logFileHandle);

This program will return the following output.
php curl error log

Part 3 – Creating PHP cURL script to extract images from a website


In this part of the article, we are going to create a end-to-end cURL component. It will do the following to achieve grabbing images from a webpage.

  1. Create API service to instantiate DOM to load response.
  2. Create cURL service to instantiate, configure and execute requests.
  3. Read cURL response and load it into the DOM object.
  4. Get the image source URL by accessing the DOM object.
  5. Create a photo gallery by using the PHP cURL response array.

API service class to initiate cURL and create DOM object


This GrabImageAPI class creates PHP DOMDocument instants to load the site HTML.

The constructor initiates cURL and grabs the complete HTML response of the URL. Then, it loads this response into the DOM object.

With the reference of the object, the getWebsiteImage() gets the image source URLs.

This function reads all images by using getElementsByTagName(). By iterating the image data array, it prepares the JSON bundle of image URLs.

Service/GrabImageAPI.php


<?php
namespace Phppot\Service; use \Phppot\Service\CurlService;
use DOMDocument; class GrabImageAPI
{ private $dom; public function __construct($url) { require_once __DIR__ . '/CurlService.php'; $curlService = new CurlService($url); $siteHTML = $curlService->executeCurl(); $this->dom = new DOMDocument(); @$this->dom->loadHTML($siteHTML); } function getWebsiteImage() { // Parse DOM to get Images $images = $this->dom->getElementsByTagName('img'); $imageSourceURL = array(); for ($i = 0; $i < $images->length; $i ++) { $image = $images->item($i); $src = $image->getAttribute('src'); if(filter_var($src, FILTER_VALIDATE_URL)) { $imageSourceURL[] = $src; } } $imageSourceJSON = json_encode($imageSourceURL); return $imageSourceJSON; }
}

Create cURL service to perform routine life cycle operations


This class is nothing but for performing basic curl operations we have seen at the beginning.

The GrabImageAPI constructor includes this service and creates the cURL instance.

Service/CurlService.php


<?php
namespace Phppot\Service; class CurlService
{ private $curl; private $endpoint; private $response; function __construct($url) { $this->endpoint = $url; $this->curl = curl_init($this->endpoint); } function setCurlOption() { curl_setopt($this->curl, CURLOPT_HEADER, 0); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, 1); } function executeCurl() { $this->setCurlOption(); $this->response = curl_exec($this->curl); curl_close($this->curl); return $this->response; }
}

Trigger API to grab images via PHP cURL post


This code will hit the API to grab images via PHP cURL post. It requires the API class reference on which it creates the dynamic image gallery using cURL.

This code is useful to create a gallery widget for your external shop independently.

php-curl-grab-image.php


<?php
namespace Phppot; use \Phppot\Service\GrabImageAPI; require_once __DIR__ . '/Service/GrabImageAPI.php';
$url = "https://domain-name-here/";
$imageSourceArray = array();
try { // Call image grab PHP cURL script $grabImageAPI = new GrabImageAPI($url); // Get image source array in JSON format via PHP cURL $imageSource = $grabImageAPI->getWebsiteImage(); $imageSourceArray = json_decode($imageSource, true);
} catch (Exception $e) { // Handle API request failure $statusMsg = $e->getMessage(); print $statusMsg; exit;
} // Iterate response and form image gallery in UI
foreach($imageSourceArray as $imageSource) { ?> <img src="<?php echo $imageSource; ?>" style="width: 300px; margin: 20px;" /> <?php }

Conclusion


Hope this article helps you to know a deep knowledge about PHP cURL post and other request methods.

The short and end-to-end examples might be useful to create a cURL component for your application.

I welcome your comments to continue giving more value-adds to the learners.
Download

↑ Back to Top



https://www.sickgaming.net/blog/2022/05/...h-example/

Print this item

  (Indie Deal) FREE AoS: Recharge, Shiro & Bandai Deals
Posted by: xSicKxBot - 05-07-2022, 02:09 AM - Forum: Deals or Specials - No Replies

FREE AoS: Recharge, Shiro & Bandai Deals

Age of Steel: Recharge FREEbie
[freebies.indiegala.com]
You're taking the role of commander, who was entrusted the management of the military base. Your mission: defend a base from the waves of enemies at any price.

https://www.youtube.com/watch?v=MrzsH52cXZw
Shiro Games Sale, up to 80% OFF
[www.indiegala.com]
Best of Bandai Sale, up to 95% OFF
[www.indiegala.com]
Save an EXTRA 30% for every bundle & an extra 15% for every store purchase when paying with any supported crypto
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...6756332131

Print this item

  PC - Trolley Problem, Inc.
Posted by: xSicKxBot - 05-07-2022, 02:08 AM - Forum: New Game Releases - No Replies

Trolley Problem, Inc.



There is a runaway trolley careering down the railway tracks. On the tracks are five people unable to move. You are next to a lever. If you pull this lever the trolley will switch to a different set of tracks. However, you notice that there is a person on the other track.

Watch the situation play out and five people die. Choose to pull the lever and only one person gets killed - but by you.

What will you do?

Trolley Problem, Inc. is a darkly comedic narrative game based on real world philosophical papers, in which you are asked to make a series of impossible choices from two awful answers. Wrestle with your moral compass, decide the fate of millions - and compare your choices with the rest of the world.

Publisher: Yogscast

Release Date: Apr 21, 2022




https://www.metacritic.com/game/pc/trolley-problem-inc

Print this item

 
Latest Threads
Redacted T6 Nightly Offli...
Last Post: Marlo
1 hour ago
Black Ops 2 Jiggy v4.3 PC...
Last Post: SinjiKoto
1 hour ago
(Free Game Key) Epic Game...
Last Post: xSicKxBot
5 hours ago
News - Paralives’ Success...
Last Post: xSicKxBot
5 hours ago
[°NeW°]⩽United Arab Emira...
Last Post: abhi89
10 hours ago
[°NeW°]⩽Switzerland⟫°TℰℳU...
Last Post: abhi89
11 hours ago
[°NeW°]⩽Ireland⟫°TℰℳU Cou...
Last Post: abhi89
Today, 06:23 AM
[°NeW°]⩽Chile⟫°TℰℳU Coupo...
Last Post: abhi89
Today, 06:19 AM
[°NeW°]⩽Pakistan⟫°TℰℳU Co...
Last Post: abhi89
Today, 06:16 AM
[°NeW°]⩽Mexico⟫°TℰℳU Coup...
Last Post: abhi89
Today, 05:42 AM

Forum software by © MyBB Theme © iAndrew 2016