Innovation in the financial technology domain aims to compete with and offer alternatives to traditional methods of delivering financial services. It is an emerging industry that is expanding digital implementation in finance with the use of technology. Developers, technologists, and industry leaders across the world collaborate through the Fintech Open Source Foundation (FINOS) on a wide range of open-source projects.

Nowadays, countless software and applications are being developed using open-source code, libraries, and other resources for the fintech domain. These software components cover functions across Contactless, Crypto Currency, Mobile Payment, peer-to-peer lending, and digital payment wallets. Explore all fintech-related open-source software, libraries, packages, source code, cloud functions, and APIs.

Popular New Releases in Fintech

freqtrade

2022.3

truffle

v5.5.11 – Dubbel Zout Licorice 🧂

web3.js

Web3.js 1.3.1

metamask-extension

Version 10.13.0

lbry-sdk

v0.107.1

Popular Libraries in Fintech

ccxt

by ccxt doticonjavascriptdoticon

star image 24082 doticonMIT

A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges

freqtrade

by freqtrade doticonpythondoticon

star image 17102 doticonGPL-3.0

Free, open source crypto trading bot

ZeroNet

by HelloZeroNet doticonjavascriptdoticon

star image 16995 doticonNOASSERTION

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network

bitcoinbook

by bitcoinbook doticonpythondoticon

star image 16943 doticonNOASSERTION

Mastering Bitcoin 2nd Edition - Programming the Open Blockchain

truffle

by trufflesuite doticontypescriptdoticon

star image 13000 doticonMIT

A tool for developing smart contracts. Crafted with the finest cacaos.

ethereumbook

by ethereumbook doticonjavascriptdoticon

star image 10272 doticonNOASSERTION

Mastering Ethereum, by Andreas M. Antonopoulos, Gavin Wood

web3.js

by ethereum doticonjavascriptdoticon

star image 9518 doticonNOASSERTION

Ethereum JavaScript API

metamask-extension

by MetaMask doticonjavascriptdoticon

star image 7807 doticonNOASSERTION

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites

mist

by ethereum doticonjavascriptdoticon

star image 7347 doticonGPL-3.0

[DEPRECATED] Mist. Browse and use Ðapps on the Ethereum network.

Trending New libraries in Fintech

bip_utils

by ebellocchia doticonpythondoticon

star image 133 doticonMIT

Generation of mnemonics, seeds, private/public keys and addresses for different types of cryptocurrencies

compound-supply-examples

by compound-developers doticonjavascriptdoticon

star image 98 doticonMIT

Code examples for supplying Ethereum assets to the Compound Protocol.

crypto-yank

by jacques-andre doticonpythondoticon

star image 51 doticonGPL-3.0

crypto-yank is a clipboard crypto stealer that monitors for crypto addresses and replaces them with your own.

stripe-connect-custom-rocketdeliveries

by stripe doticonjavascriptdoticon

star image 39 doticonMIT

Sample on-demand platform built on Stripe Connect: Custom Accounts and Connect Onboarding for deliveries. https://rocketdeliveries.io

tbtc.js

by keep-network doticonjavascriptdoticon

star image 39 doticonMIT

JS to access trustlessly tokenized threshold Bitcoin on Ethereum ;)

invizi

by invizi doticonjavascriptdoticon

star image 37 doticonGPL-3.0

Invizi is a private cryptocurrency tracker. All your data is stored locally, encrypted and never leaves your computer. Invizi is 100% free.

defi18n

by nanexcool doticonjavascriptdoticon

star image 35 doticonCC0-1.0

Free translation strings for dapps and crypto wallets.

taylor

by loredanacirstea doticonjavascriptdoticon

star image 28 doticonGPL-3.0

Measure twice, cut once. Lisp-like functional language for computable & immutable specifications, interpreted by WebAssembly & the Ethereum Virtual Machine.

ShinobuClipper

by LimerBoy doticoncsharpdoticon

star image 28 doticonMIT

:moneybag: Replace any BTC, XMR, XLM, ETH, XRP, LTC, BCH, NEC, DASH, WMR, WMZ, WMH, WMU, QIWI, Yandex Money, Steam trade addresses in clipboard.

Top Authors in Fintech

1

PowerMobileWeb

7 Libraries

star icon62

2

0xcert

7 Libraries

star icon114

3

IBM

7 Libraries

star icon185

4

miguelmota

6 Libraries

star icon71

5

openblockchains

4 Libraries

star icon3163

6

VirgilSecurity

4 Libraries

star icon39

7

blockchain-council

4 Libraries

star icon40

8

kleros

4 Libraries

star icon59

9

ArkEcosystem

4 Libraries

star icon33

10

pokt-network

4 Libraries

star icon23

1

7 Libraries

star icon62

2

7 Libraries

star icon114

3

7 Libraries

star icon185

4

6 Libraries

star icon71

5

4 Libraries

star icon3163

6

4 Libraries

star icon39

7

4 Libraries

star icon40

8

4 Libraries

star icon59

9

4 Libraries

star icon33

10

4 Libraries

star icon23

Trending Kits in Fintech

Since 2019, retail trading has surged in the USA. With a combination of digital technology, access to financial advice (not guaranteed to be sound), reducing commissions, and folks confined at home with a pandemic, retail trading has been moving the markets.

This volatile combination has birthed a class of stocks called 'Meme Stocks'. Meme stocks don't go by the textbook classifications of growth or value stock. They are discussed heavily by retail investors on Reddit, Stocktwits, Twitter, and other channels. They are primarily overpriced, volatile and the valuation does not line up with the hype. Only the early adopters profit from these stocks. Stocks of GameStop, AMC, SPACs have followed this trend. Meme stocks have significantly impacted the markets to the extent that hedge funds see short selling as risky until the retail wave subsides. With the U.S. central counterparty clearinghouses raising margin requirements, the liquidity needs have imposed trading restrictions for individual investors.

Given the frenzy driven by digital technologies, there are over twenty thousand public libraries available for trading. kandi collection on Meme Stocks and Options Trading showcases public libraries that provide access to real-time and historical stock data, analytics solutions to understand trends and volatility, backtesting solutions to simulate trades, and full-fledged trading engines.

End-to-End Trading Engines

Lean by QuantConnect, StockSharp by StockSharp, and LiuAlgoTrader by amor71 are popular end-to-end trading engines and frameworks.

Stock Data Retrieval and Storage

ck by concurrencykit, FinMind by FinMind, redtide by qks1lver, and Python-NSE-Option-Chain-Analyzer by VarunS2002 enable you to access data from global exchanges and store them in high performance efficient concurrent data structures.

Financial and Mathematical Models

MachineLearningStocks by robertmartin8, finmath-lib by finmath and GraphVega by rahuljoshi44 enable you to try different financial and mathematical models on stocks to understand their technical valuation.

Simulation and Backtesting

optopsy by michaelchu, paperbroker by philipodonnell and TuringTrader by fbertram enable you to simulate and backtest trades.

ProPublica* reported that billionaires pay little in income tax compared to their massive wealth, sometimes, even nothing. Their records show that the wealthiest can legally pay income taxes amounting to a tiny fraction of the billions their fortunes grow each year. The median American household earned about $70,000 annually and paid about 14% in federal taxes. The highest income tax rate of 37% applies for couples on earnings above $628,300. However, the 25 wealthiest Americans paid a true tax rate of only 3.4%.

You will need sound financial advisors to achieve such tax rates. But as technologists, open source can help you in two remarkable ways. You can save significantly by using open source software, and you can use the below personal finance solutions to manage your wealth.

Personal finance helps individuals and families handle their financial management. Based on the spectrum of personal financial activities, this can span across banking products (checking, savings accounts, cards, wallets, and loans) or investments (shares, bonds, mutual funds) and insurance (life, health, disability) products or retirement plans, social security, and income tax management.

There are over 1,800 public libraries available for you to adopt personal finance solutions. kandi collection on Personal Finance Solutions showcases libraries across end-to-end personal finance management platforms, frameworks for creating your own accounting solution, simple budgeting solutions, and add-ons like mobile receipt scanners that make your life easier.

End-to-End Solutions

firefly-iii by firefly-iii, moneymanagerex by moneymanagerex and rotki by rotki are most popular end-to-end personal finance management solutions covering aspects across expenses, investments, banking, and others.

Foundational Framework

If you are looking for flexibility in creating your own solution income-expense by dbrax provides a foundational framework.

Simple Budgeting Functions

my-budget by reZach and budget by range-of-motion and provide simple budget and expense management functions.

Text and Spreadsheet Solutions

knut by sboehler and mintable by kevinschaich provide even simpler text-based or spreadsheet-based management.

Individual Functions

Try SmartReceiptsLibrary by SmartReceipts to scan your receipts.

A payment processing library can help make your eCommerce application-independent and well-equipped to handle multiple payment gateways. A PHP payment processing software enables multiple features like payment methods, secure authentication, integration with third-party software, etc. With this, you can add popular platforms like PayPal, Apple Pay, Google Pay, Stripe, UnionPay, and more to your web application. PHP allows developers to build fast and scalable applications that provide risk-free solutions to payment woes. With the help of these libraries, you can enable several online payment options like integration with the shopping cart, faster processing, multiple payment platforms, charge back prevention, fraud management, recurring billing, etc.

Below are our 20 best PHP payment processing open source libraries in 2021. Omnipay is a framework agnostic, multi-gateway payment processing library built for PHP 5.6+. Its consistent API is fully unit tested and comes with an example application for beginners. Here, you can learn an API and use it in multiple projects without rewriting the code. Another library, InvoicePlane is a self-hosted open-source application that manages invoices, clients, and payments. Payum Bundle, on the other hand, is an MIT-licensed open-source project that offers all payment-related solutions. It supports both simple use cases as well as very advanced ones.

All new-age finance professionals committed to data analysis and data science are dependent on Python at some level. It is with Python that they can perform analysis on various financial data points. But Python turns out to be a formidable tool even while developing personal finance applications. For instance, you can scrape the web for personal finance data, download financial transactions, develop a budget tracking app, and so on, all with Python.

With that in mind, let’s have a quick overview of some of the best open-source Python packages and libraries for personal finance. Ofxstatement is a tool developed with the intention to convert proprietary bank statements to OFX format which is the accepted format for major personal accounting systems. One of the best open-source Python packages, finance-dl is used for scraping personal finance data from various financial institutions. It performs best when used with beancount-import which is a tool for semi-automatic data importing. We also have MyMoney, which is essentially a web application for personal finance built with Django. It can manage your bank account, your transactions, analyze them and schedule them if they’re recurrent. MyMoney a simple tool with the goal to analyze your expenses.

this one helps with Spring Framework building and deploy web applications easily updated

this is para2

this is para3

Development Environment

In August 2021, the U.S. Department of Justice repatriated an additional $452 million in 1MDB funds to Malaysia. This repatriation took the total amount recovered from the corruption scandal to $1.2 billion. The funds had been laundered through major financial institutions worldwide, including in the United States, Switzerland, Singapore, and Luxembourg.

While there are multiple global regulations targeting money laundering, multiple estimates peg the size of money laundering between $800 billion to $2 trillion annually. While there are multiple commercially available AML packages, the core technologies are the ability to stream-process vast sources of information and intelligent algorithms to identify money laundering patterns.

kandi collection on Anti-Money Laundering covers open source libraries across data scraping, stream processing, open source intelligence (OSINT Framework), anti-money laundering algorithms, and case management for anti-money laundering.

Scraping and Stream Processing

Key inputs for an AML solution are processing a variety of sources of information. Web scraping and real time streaming solutions help achieve this. For more insights on streaming refer to the kandi kit - Building a Stream Processing Application using open source libraries . For more insights on web scraping refer to the kandi collection - 13 best Python Web Scraping libraries in 2021.

Open Source Intelligence

A variety of open source intelligence tools enable targeting information gathering from multiple sources.

Anti-Money Laundering Algoritms

AML algorithms are key in identifying fraud patterns and flagging them.

Case Management for Anti-Money Laundering

Case management libraries process the alerts raised by the AML algorithms. Below are libraries spanning across general process management to ones tailored to legal and fraud management.

Binance operates the world's biggest bitcoin exchange and altcoin crypto exchange in the world by volume. The Financial Conduct Authority (FCA) has ruled that the firm cannot conduct any "regulated activity" in the UK. It also issued a consumer warning about Binance.com, advising people to be wary of adverts promising high returns on crypto-asset investments. The US Securities and Exchange Commission (SEC) and Japan's Financial Services Agency (FSA) had also issued warnings about Binance.

Crypto exchanges allow customers to trade cryptocurrencies with other assets, such as money or other digital currencies. Exchanges may accept credit card payments, wire transfers, or other forms of charge in exchange for cryptocurrencies. The exchanges can send cryptocurrency to a user's wallet or convert digital currency balances into prepaid cards to withdraw funds from ATMs worldwide. In contrast, other digital currencies are backed by real-world commodities such as gold. The regulation of crypto exchanges differs from country to country.

While Binance is a market leader, there are multiple other crypto exchanges. kandi collection on Binance Alternatives lists accelerators across other popular exchanges such as Robinhood Crypto, Coinbase, Poloniex, Uphold, and Kraken. Do not construe this as financial or legal advice.

Robinhood Crypto Libraries

robin_stocks by jmfernandes, robinhood-crypto by wang-ye, and robinhood-observer by jspenc72 enable integration with Robinhood Crypto.

Coinbase Libraries

optimal-buy-cbpro by brndnmtthws, coinbase-exchange-order-book by PierreRochard, and open-source-coinbase-index-fund by acmeyer are popular Coinbase focused libraries.

Poloniex Libraries

If you are looking to leverage Poloniex, try MikaLendingBot by BitBotFactory, python-poloniex by s4w3d0ff, and Personal - Poloniex Trading Bot by dalton_baker.

Uphold Libraries

uphold-sdk-javascript by uphold, uphold-sdk-python by byrnereese, uphold-sdk-android by uphold, and uphold-sdk-ios by uphold enable you to trade on Uphold.

Kraken Libraries

Alternatively, aio-kraken-ws by cdlr75, Telegram-Kraken-Bot by Endogen, kraken-go-api-client by beldur, and npm-kraken-api by nothingisdead allow you to trade on Kraken.

Cryptocurrencies ushered in an era of digital assets that eased the medium of exchange while ensuring secure transaction records. As a result, the entire supply chain of creation and transfer is transparent, secure, and verifiable, making cryptocurrencies a mainstay in Fintech. Bitcoin was released in 2009 as an open source software and a decentralized cryptocurrency. Following Bitcoin, multiple cryptocurrencies have been created with Bitcoin and Ethereum holding market leadership. In April 2021, the total market cap of cryptocurrencies surpassed the USD two trillion mark.

Cryptocurrencies bring transparency and speed. However, the lack of sovereign guarantees and central banking regulation has raised multiple governance issues. For example, the legality and taxation of cryptocurrencies vary by country and are still evolving. In addition, cryptocurrencies have been the target of speculation, fraud, theft, and darknet transactions that highlight the lack of central regulating authorities.

Multiple factors impact the value of cryptocurrencies. The most famous factor in recent times is Elon Musk. While actions of leaders of states impacted their economies, cryptocurrencies are open to influence from nonstate actors. Elon Musk's Tesla announced it would buy $1.5 billion worth of bitcoin and said it would accept the virtual currency as payment for its electric cars. However, a few months later, Musk tweeted on the nonsustainable energy consumption of cryptocurrencies, knocking off their value. He increased the value of Dogecoin through his tweets. While there are more significant issues facing cryptocurrencies, Musk's tweets are probably the most visible ones, and accusations range from speculation to conflict of interest.

kandi collection on Elon Musk Crypto Tweet Trackers provides you with public libraries that you can try for free and provide you functions to automate trades, review the impact of cryptocurrencies based on his tweets, and some other fun projects. Do not construe this as financial or legal advice.

Compare Prices

elon_doge_tracker by rodgerbenham and TLSA-vs-Elon-s-Tweets by Joerg-ffs compare Elon Musk's tweets to the Tesla stock price and Dogecoin.

Trading Bots

bitcoin-bot-buy-if-elon-tweets by CyberPunkMetalHead, elonbot by vslaykovsky, tradoge by gschurck, Twitter_Activated_Crypto_Trading_Bot by jaimindp, moon-doge by antoinebaron-io and Elon-Alert by oguzdelioglu are automated trading bots that help you trade cryptocurrencies based on his tweets.

Fun Projects

Finally, if you care less for cryptocurrencies and are just looking for fun, RandomElon by thecookiemonsters and elon-bot by Macr0Nerd help produce random Elon Musk quotes.

Did you know Bitcoin consumes more electricity than the whole country of Sweden? Bitcoin compares to over 10 times the global solar and wind energy produced. On a global scale, Bitcoin uses 0.66% of all electricity consumed worldwide. That is huge for a new-age digital currency!

The core issue in cryptocurrencies has been mining. Most cryptocurrencies rely on a computational competition called Proof of Work (PoW). In this model, participants are rewarded with cryptocoins for adding transactions to the blockchainÆs globally distributed ledger. More computational capability means a higher chance to earn more cryptocoins. Application-specific ICs (ASICs) that accelerate mining, concentrated power over many cryptocurrencies. EthereumÆs ether-mining algorithm penalizes the use of ASICs.

However, turning towards energy-efficient approaches, proof of stake (PoS) is a credible alternative to the PoW approach. Replacing the concept of all processors processing duplicate transactions, PoS randomly picks one to do the job to make this efficient. The validatorÆs stake or collateral ensures the authenticity of the validation.

kandi collection on Sustainable Cryptocurrencies, lists energy efficient cryptocurrency libraries for you to try. Each may follow different approaches to improve sustainability over Bitcoin.

For other cryptocurrencies or specific implementations, search on kandi.

Source credit for Bitcoin energy comparisons: https://cbeci.org/cbeci/comparisons

Proof of Stake Approach

eos by EOSIO, go-algorand by algorand, cardano-node-docker by abracadaniel, and metahash-fullnode-client by metahashorg are popular cyptocurrencies leveraging the Proof of Stake approach.

Block Lattice Technology

nano-node by nanocurrency leverages energy efficient Block Lattice Technology.

Stellar Consensus Protocol

stellar-core by stellar supports traditional currencies and leverages its proprietary Stellar Consensus Protocol that is efficient.

HoloTokens

holochain by holochain brings in a unique no mining approach using HoloTokens that makes it inherently energy efficient.

Proof of Capacity

burstcoin-jminer by de-luxe leverages the Proof of Capacity approach.

Energy Incentives

SolarCoin-Raspberry-Pi-Node by Scalextrix incentivizes Solar Energy production and hedera-services by hashgraph leverages the Power Transition tool to drive energy efficiency.

Cryptocurrency wallets are software programs that store your public and private keys and interface with various blockchain so users can monitor their balance, send money and conduct other operations. If you want to use Bitcoin or any other cryptocurrency, you will need to have a digital wallet. A cryptocurrency wallet is a software program designed to store your public and private keys, send and receive digital currencies, monitor their balance, and interact with various blockchains. You need to have a cryptocurrency wallet. The following libraries can be used to generate and manage keys, create wallets, sign transactions and broadcast them to the network among other functionalities.. The best JavaScript Cryptocurrency Wallet libraries in 2022:WalletConnect - A standard for connecting to web wallets using a QR Code; Uport - Self sovereign identity platform; Universal Login SDK - A complete identity and wallet system for Ethereum; Ethers.js - An open source library for building dapps on Ethereum.

If you're new to DeFi, here's a quick primer: DeFi is short for decentralized finance. It's a way for businesses to leverage the benefits of blockchain technology without having to sacrifice the security, speed, and scale of existing financial services solutions. The last couple of years have been huge for decentralized (DeFi) projects, and it's only going to get bigger. With the growing interest in smart contracts, crypto assets, and the wider benefits of decentralized exchange services, companies have already invested heavily into the future of decentralized finance. Now, we're reaching a point where DeFi is no longer a corner case niche; the average person is more educated in the use of wallets and private keys, as well as the wider benefits of decentralized currency. So what does this mean for you? Well, if you want to stay up to date on all things DeFi then you're going to need some resources to help you get started. Luckily I've put together reusable opensource libraries that you can use with top DeFi such as Terra LUNA, Avalanche, Dai, ChainLink, Uniswap, Fantom, Theta Network, THORChain, Tezos and others.

Build high quality encrypted wallets with other incredible features for your Bitcoin. Get ratings, code snippets & documentation for each library.

Build wallets, mine coins, integrate with crypto exchanges, trading bots, and more for Ethereum .Get ratings, code snippets & documentation for each library.

Trending Discussions on Fintech

postgres: LEFT JOIN table and field does not exist

Webpage starts zoomed out on mobile devices

Not able to render axios's response with map

JSON html string to a new page

Django render many to many attributes after query, display None

Python web scraper, with BeautifulSoup I am having problem with my link , the link is now going to headline story but redirecting to the archives page

Trying to get property 'title' of non-object Curl PHP

Using float left and right/ width 50% is not allowing my content to be responsive on mobile view

How can I solve the npm run dev error I'm facing after creating a new Laravel 7 project?

getting error when trying to convert object column into int

QUESTION

postgres: LEFT JOIN table and field does not exist

Asked 2022-Apr-15 at 08:16

This is my query

1SELECT org.id,
2                org.name,
3                org.type,
4                org.company_logo,
5                (SELECT org_profile.logo_url FROM org_profile WHERE org_profile.org_id = org.id AND org_profile.status = 'active' ORDER BY org_profile.id DESC LIMIT 1) as logo_url,
6                org.short_description,
7                org_profile.value_prop,
8                count(*) OVER () AS total
9                FROM org
10                LEFT JOIN user_info ON user_info.id = org.approved_by
11                INNER JOIN (select distinct org_profile.org_id from org_profile) org_profile ON org_profile.org_id = org.id
12                WHERE
13                org.type = 'Fintech'
14                AND org.status = 'APPROVED'
15                AND org.draft != TRUE
16                ORDER BY org.id DESC
17            
18

I am using LEFT JOIN query with my org_profile table. I used distinct for unique org id but the problem is org_profile.value_prop column does not work. The error is showing column org_profile.value_prop does not exist

I'm trying to solve this issue. But I don't figure out this issue.

ANSWER

Answered 2022-Apr-15 at 07:22

basically, the error informs that you try to get the value_prop field from org_profile subquery, which basically doesn't exist.

It's difficult to give a working query by writting just on the paper, but I think that:

  • it's worth to apply the handy aliasses for each subquery
  • deduplication, if required, should be done in the subquery. When multiple fields used DISTINCT may be insufficient - RANK function may be required.
  • you make some operations to get the logo_url by a scalar subquery - it seems a bit strange, especially the same table is used in JOIN - I would suggest to move all logic related to org_profile to the subquery. Scalar expressions would throw an error in case multiple values would be found in output.
1SELECT org.id,
2                org.name,
3                org.type,
4                org.company_logo,
5                (SELECT org_profile.logo_url FROM org_profile WHERE org_profile.org_id = org.id AND org_profile.status = 'active' ORDER BY org_profile.id DESC LIMIT 1) as logo_url,
6                org.short_description,
7                org_profile.value_prop,
8                count(*) OVER () AS total
9                FROM org
10                LEFT JOIN user_info ON user_info.id = org.approved_by
11                INNER JOIN (select distinct org_profile.org_id from org_profile) org_profile ON org_profile.org_id = org.id
12                WHERE
13                org.type = 'Fintech'
14                AND org.status = 'APPROVED'
15                AND org.draft != TRUE
16                ORDER BY org.id DESC
17            
18SELECT 
19  org.id,
20  org.name,
21  org.type,
22  org.company_logo,
23  prof.logo_url,
24  org.short_description,
25  prof.value_prop,
26  count(*) OVER () AS total
27FROM org
28JOIN (
29  select distinct org_id, logo_url, value_prop -- other deduplication type (RANK) may be required
30  from org_profile
31  where status = 'active' -- ?
32) prof ON org.id = prof.org_id
33LEFT JOIN user_info usr ON usr.id = org.approved_by
34WHERE
35  org.type = 'Fintech'
36  AND org.status = 'APPROVED'
37  AND org.draft != TRUE
38ORDER BY org.id DESC
39

Source https://stackoverflow.com/questions/71881033

QUESTION

Webpage starts zoomed out on mobile devices

Asked 2022-Jan-15 at 20:33

I have created a website for desktop and mobile, and it has to be responsive. My problem is that when I resize the browser all the content gets zoomed out instead of adapting. I also have an issue with the HTML. why is it only taking up 1/3 of the page according to dev tools and when I add width:1100px to my sections it renders the desktop version, but when I take it away it floats to the left side? Why is this happening?

Images of the problem:

1* {
2     margin: 0;
3     padding: 0;
4     box-sizing: border-box;
5}
6 body {
7     font-family: 'Source Sans Pro', sans-serif;
8     background-color: black;
9     color: white;
10     line-height: 30px;
11}
12 html {
13     width:100%;
14}
15 img {
16     width: 100%;
17}
18 h1 {
19     font-weight: 700;
20     font-size: 44px;
21     margin-bottom: 40px;
22     line-height: 50px;
23}
24 h3 {
25     width: 100%;
26}
27/* header */
28 header {
29     display: flex;
30     background-color: black;
31     height: 80px;
32     min-width: 1100px;
33     justify-content: right;
34     align-items: center;
35     margin-bottom: 50px;
36     border-bottom: 1px solid white;
37}
38 nav ul li {
39     display: inline-block;
40     list-style-type: none;
41     margin-right: 20px;
42}
43 .nav-links{
44     color: white;
45     font-size: 18px;
46}
47/* Banner */
48 .banner {
49     display: flex;
50     justify-content: space-around;
51     align-items: center;
52     min-height: 500px;
53     width: 100%;
54}
55 .banner-text-container {
56     max-width: 30%;
57     font-size: 22px;
58}
59 span {
60     color: #11cc9e;
61}
62 .consultation-link{
63     color: #11cc9e;
64     text-decoration: none;
65     margin-top: 30px;
66     font-weight: 900;
67     display: block;
68     border: 1px solid white;
69     max-width: 40%;
70     text-align: center;
71     padding: 5px;
72}
73 .consultation-link:hover{
74     background-color: #fff;
75}
76/* About */
77 .about {
78     display: flex;
79     justify-content: space-around;
80     align-items: center;
81     min-height: 600px;
82     min-width: 1100px;
83}
84 .about-text-container {
85     max-width: 40%;
86     font-size: 22px;
87     margin-left: 20px;
88}
89 .about-img{
90     width: 400px;
91     margin-right: 22px;
92}
93 .about-title {
94     margin-bottom: 40px;
95}
96 .about-us-link{
97     color: #11cc9e;
98     text-decoration: none;
99     margin-top: 30px;
100     font-weight: 900;
101     display: block;
102     border: 1px solid white;
103     text-align: center;
104     max-width: 25%;
105     padding: 5px;
106}
107 .about-us-link:hover{
108     background-color: #fff;
109}
110/* Join */
111 .join {
112     min-height: 600px;
113     min-width: 1100px;
114     max-width: 100%;
115}
116 .join-header{
117     width: 100%;
118     text-align: center;
119     margin-top: 150px;
120     font-size: 40px;
121}
122 .container-boxes{
123     position: relative;
124     top: 0;
125     bottom: 0;
126     display: flex;
127     flex-wrap: wrap;
128     justify-content: space-evenly;
129     align-items: center;
130     min-height: 500px;
131     min-width: 1100px;
132}
133 .box {
134     position: relative;
135     overflow: hidden;
136     transition: 0.5s;
137     height: 200px;
138     width: 300px;
139}
140 .box:hover{
141     z-index: 1;
142     transform: scale(1.25);
143     box-shadow: 0 25px 40px rgba(0, 0, 0, .5);
144     cursor: pointer;
145}
146 .box .imgBX{
147     position: absolute;
148     top: 0;
149     left: 0;
150     width: 100%;
151     height: 100%;
152}
153 .box .imgBX img{
154     position: absolute;
155     top: 0;
156     left: 0;
157     width: 100%;
158     height: 100%;
159     object-fit: cover;
160}
161 .box .imgBX:before{
162     content: '';
163     position: absolute;
164     top: 0;
165     left: 0;
166     width: 100%;
167     height: 100%;
168     z-index: 1;
169     background: linear-gradient(180deg,rgba(0,0,0.7),#79dbc3);
170     mix-blend-mode: multiply;
171     opacity: 0;
172     transition: 0.5s;
173}
174 .box:hover .imgBX:before {
175     opacity: 1;
176}
177 .box .imgBX img{
178     position: absolute;
179     top: 0;
180     left: 0;
181     width: 100%;
182     height: 100%;
183     object-fit: cover;
184}
185 .content{
186     display: flex;
187     flex-direction: column;
188     text-align: center;
189     position: absolute;
190     top: 20%;
191     bottom: 40%;
192     width: 100%;
193     height: 100%;
194     z-index: 1;
195     padding: 20px;
196     visibility: hidden;
197}
198 .box:hover .content{
199     visibility: visible;
200}
201/* Quote section */
202 .quote-section {
203     display: flex;
204     justify-content: center;
205     max-width: 100%;
206     min-height: 500px;
207     min-width: 1100px;
208}
209 .quote-container {
210     display: flex;
211     flex-direction: column;
212     flex-wrap: wrap;
213     align-items: center;
214     justify-items: center;
215     max-width: 50%;
216     font-size: 22px;
217     text-align: center;
218}
219 .quote {
220     line-height: 90px;
221     font-size: 150px;
222     font-style: italic;
223     color: #11cc9e;
224     text-indent: -37px;
225     font-weight: 600;
226     width: 37px;
227}
228 .quote-img{
229     width: 90px;
230     margin: 40px auto;
231}
232 .person-name{
233     color: #ccc;
234}
235 .person-role{
236     font-size: 17px;
237     color: #ccc;
238}
239/* Footer */
240 footer {
241     text-align: center;
242     margin-top: 100px;
243     padding-top: 50px;
244     max-width: 100%;
245     min-height: 200px;
246     min-width: 1100px;
247     border-top: 1px solid #fff;
248}
1* {
2     margin: 0;
3     padding: 0;
4     box-sizing: border-box;
5}
6 body {
7     font-family: 'Source Sans Pro', sans-serif;
8     background-color: black;
9     color: white;
10     line-height: 30px;
11}
12 html {
13     width:100%;
14}
15 img {
16     width: 100%;
17}
18 h1 {
19     font-weight: 700;
20     font-size: 44px;
21     margin-bottom: 40px;
22     line-height: 50px;
23}
24 h3 {
25     width: 100%;
26}
27/* header */
28 header {
29     display: flex;
30     background-color: black;
31     height: 80px;
32     min-width: 1100px;
33     justify-content: right;
34     align-items: center;
35     margin-bottom: 50px;
36     border-bottom: 1px solid white;
37}
38 nav ul li {
39     display: inline-block;
40     list-style-type: none;
41     margin-right: 20px;
42}
43 .nav-links{
44     color: white;
45     font-size: 18px;
46}
47/* Banner */
48 .banner {
49     display: flex;
50     justify-content: space-around;
51     align-items: center;
52     min-height: 500px;
53     width: 100%;
54}
55 .banner-text-container {
56     max-width: 30%;
57     font-size: 22px;
58}
59 span {
60     color: #11cc9e;
61}
62 .consultation-link{
63     color: #11cc9e;
64     text-decoration: none;
65     margin-top: 30px;
66     font-weight: 900;
67     display: block;
68     border: 1px solid white;
69     max-width: 40%;
70     text-align: center;
71     padding: 5px;
72}
73 .consultation-link:hover{
74     background-color: #fff;
75}
76/* About */
77 .about {
78     display: flex;
79     justify-content: space-around;
80     align-items: center;
81     min-height: 600px;
82     min-width: 1100px;
83}
84 .about-text-container {
85     max-width: 40%;
86     font-size: 22px;
87     margin-left: 20px;
88}
89 .about-img{
90     width: 400px;
91     margin-right: 22px;
92}
93 .about-title {
94     margin-bottom: 40px;
95}
96 .about-us-link{
97     color: #11cc9e;
98     text-decoration: none;
99     margin-top: 30px;
100     font-weight: 900;
101     display: block;
102     border: 1px solid white;
103     text-align: center;
104     max-width: 25%;
105     padding: 5px;
106}
107 .about-us-link:hover{
108     background-color: #fff;
109}
110/* Join */
111 .join {
112     min-height: 600px;
113     min-width: 1100px;
114     max-width: 100%;
115}
116 .join-header{
117     width: 100%;
118     text-align: center;
119     margin-top: 150px;
120     font-size: 40px;
121}
122 .container-boxes{
123     position: relative;
124     top: 0;
125     bottom: 0;
126     display: flex;
127     flex-wrap: wrap;
128     justify-content: space-evenly;
129     align-items: center;
130     min-height: 500px;
131     min-width: 1100px;
132}
133 .box {
134     position: relative;
135     overflow: hidden;
136     transition: 0.5s;
137     height: 200px;
138     width: 300px;
139}
140 .box:hover{
141     z-index: 1;
142     transform: scale(1.25);
143     box-shadow: 0 25px 40px rgba(0, 0, 0, .5);
144     cursor: pointer;
145}
146 .box .imgBX{
147     position: absolute;
148     top: 0;
149     left: 0;
150     width: 100%;
151     height: 100%;
152}
153 .box .imgBX img{
154     position: absolute;
155     top: 0;
156     left: 0;
157     width: 100%;
158     height: 100%;
159     object-fit: cover;
160}
161 .box .imgBX:before{
162     content: '';
163     position: absolute;
164     top: 0;
165     left: 0;
166     width: 100%;
167     height: 100%;
168     z-index: 1;
169     background: linear-gradient(180deg,rgba(0,0,0.7),#79dbc3);
170     mix-blend-mode: multiply;
171     opacity: 0;
172     transition: 0.5s;
173}
174 .box:hover .imgBX:before {
175     opacity: 1;
176}
177 .box .imgBX img{
178     position: absolute;
179     top: 0;
180     left: 0;
181     width: 100%;
182     height: 100%;
183     object-fit: cover;
184}
185 .content{
186     display: flex;
187     flex-direction: column;
188     text-align: center;
189     position: absolute;
190     top: 20%;
191     bottom: 40%;
192     width: 100%;
193     height: 100%;
194     z-index: 1;
195     padding: 20px;
196     visibility: hidden;
197}
198 .box:hover .content{
199     visibility: visible;
200}
201/* Quote section */
202 .quote-section {
203     display: flex;
204     justify-content: center;
205     max-width: 100%;
206     min-height: 500px;
207     min-width: 1100px;
208}
209 .quote-container {
210     display: flex;
211     flex-direction: column;
212     flex-wrap: wrap;
213     align-items: center;
214     justify-items: center;
215     max-width: 50%;
216     font-size: 22px;
217     text-align: center;
218}
219 .quote {
220     line-height: 90px;
221     font-size: 150px;
222     font-style: italic;
223     color: #11cc9e;
224     text-indent: -37px;
225     font-weight: 600;
226     width: 37px;
227}
228 .quote-img{
229     width: 90px;
230     margin: 40px auto;
231}
232 .person-name{
233     color: #ccc;
234}
235 .person-role{
236     font-size: 17px;
237     color: #ccc;
238}
239/* Footer */
240 footer {
241     text-align: center;
242     margin-top: 100px;
243     padding-top: 50px;
244     max-width: 100%;
245     min-height: 200px;
246     min-width: 1100px;
247     border-top: 1px solid #fff;
248}<!DOCTYPE html>
249<html lang="en">
250   <head>
251      <title>Codes</title>
252      <link rel="preconnect" href="https://fonts.googleapis.com">
253      <ink rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
254      <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap" rel="stylesheet">
255      <meta charset="UTF-8">
256      <meta http-equiv="X-UA-Compatible" content="IE=edge">
257      <meta name="viewport" content="width=device-width, initial-scale=1">
258      <link rel="stylesheet" href="./Resources/styles.css">
259   </head>
260   <body>
261      <header>
262         <!-- insert logo -->
263         <nav class="nav-links">
264            <ul>
265               <li>About</li>
266               <li>Peer group</li>
267               <li>Review</li>
268            </ul>
269         </nav>
270      </header>
271      <section class="banner">
272         <div class="banner-text-container">
273            <h1>Build. Grow. <span class="color-Learn">Learn.</span></h1>
274            <p>Unlock your potential with your peers!, using Blockchain, Fintech or the IT outsourcing company Boosty Labs helps you create an innovative end to end product or augment your team with the right experts.</p>
275            <a class="consultation-link" href="#">Free consultation </a>
276         </div>
277         <div class="banner-img">
278            <img src="./Resources/Images/banner.png" alt="">
279         </div>
280      </section>
281      <section class="about">
282         <div class="about-text-container">
283            <h2 class="about-title">Who we are</h2>
284            <p>Here you can find our ,collection of coding, data science and statistics tutorials with examples in R, Python, JavaScript and Python. As you click through, you'll notice that some tutorials have ribbons on their logos - they are part of our free and self-paced online course Data Science for Ecologists and Environmental Scientists! Yellow for the Stats from Scratch stream, blue for Wiz of Data Viz and purple for Mastering Modelling.</p>
285            <a class="about-us-link" href="#">More about us </a>
286         </div>
287         <div class="about-img">
288            <img src="./Resources/Images/whoweare.png" alt="">
289         </div>
290      </section>
291      <section class="join">
292         <h3 class="join-header" >Join a peer group!</h3>
293         <div class="container-boxes">
294            <div class="box">
295               <div class="imgBX"> 
296                  <img src="./Resources/Images/box-1.png" alt="">
297               </div>
298               <div class="content">
299                  <h3>AI</h3>
300                  <P>Discover The Complete Range Of Artificial Intelligence Solutions.</P>
301               </div>
302            </div>
303            <div class="box">
304               <div class="imgBX">
305                  <img src="./Resources/Images/box-2.png" alt="">
306               </div>
307               <div class="content">
308                  <h3 class="frontend-title">Frontend Dev</h3>
309                  <p>Discover The Complete Range Of Frontend Solutions.</p>
310               </div>
311            </div>
312            <div class="box">
313               <div class="imgBX">
314                  <img src="./Resources/Images/box-3.png" alt="">
315               </div>
316               <div class="content">
317                  <h3>Microsoft systems</h3>
318                  <p>Discover The Complete Range Of Microsoft Solutions.</p>
319               </div>
320            </div>
321         </div>
322      </section>
323      <section class="quote-section">
324         <div class="quote-container">
325            <div class="quote">"</div>
326            <p class="p-quote">In coded, the progress of the topics and the exercises are really good. It's so nice to practice on good story told tasks. Also if you are stuck, it is nice to have a broad range of coders around in the peer groups  that you can get the answers you are looking for.</p>
327            <div class="quote-img">
328               <img src="./Resources/Images/person-img.png" alt="">
329            </div>
330            <div class="person-name">Peter Gangland </div>
331            <div class="person-role">Director of business dev at <span>Microsoft</span></div>
332         </div>
333      </section>
334      <footer>
335         <div id="contact">
336            <h2>
337            Contact us</h5>
338            <h5>coded@peers.com</h5>
339            <h5>831-867-5309</h5>
340         </div>
341         <div id="copyright">
342            <h5>@copyright coded Enterprises 2022</h5>
343         </div>
344      </footer>
345   </body>
346</html>

ANSWER

Answered 2022-Jan-15 at 19:43

For making your website responsive you need to use media queries. It's like you tell the browser how to style your website in different sizes. I think your problem with your sections might also get solved if you try to make your website responsive.

Source https://stackoverflow.com/questions/70724640

QUESTION

Not able to render axios's response with map

Asked 2021-Nov-23 at 23:44

I am facing an issue rendering axios get response response in my react component. I can see that my get request is successfull and that data is retrieved from my backend however when rendering I get this error :

1TypeError: startup.map is not a function
2CardList
3C:/personalworkspace/unicorn/front/src/components/CardList.js:30
4  27 | 
5  28 |  return (
6  29 |    <div className="card list">
7> 30 |      <Grid container spacing={4}>
8     | ^  31 |        {startup.map((startups) => (
9  32 |          <Grid key={startups.id} item xs={4}>
10  33 |            <Link to={{ pathname: `product/${startups.id}` }}> 
11

Here is my code :

1TypeError: startup.map is not a function
2CardList
3C:/personalworkspace/unicorn/front/src/components/CardList.js:30
4  27 | 
5  28 |  return (
6  29 |    <div className="card list">
7> 30 |      <Grid container spacing={4}>
8     | ^  31 |        {startup.map((startups) => (
9  32 |          <Grid key={startups.id} item xs={4}>
10  33 |            <Link to={{ pathname: `product/${startups.id}` }}> 
11import React from 'react';
12import CardComponent from './CardComponent';
13import { Grid } from '@material-ui/core';
14import { Link } from 'react-router-dom';
15import { useState, useEffect } from 'react';
16import StartUpService from './../Services/StartUpService';
17
18const CardList = () => {
19  const [startup, setstartups] = useState([]);
20  
21
22  useEffect(() => {
23    retrieveTutorials();
24  }, []);
25
26  const retrieveTutorials = () => {
27    StartUpService.getAll()
28      .then((response) => {
29        const myData = response.data;
30        setstartups(myData);
31        console.log(myData);
32      })
33      .catch((e) => {
34        console.log(e);
35      });
36  };
37
38  return (
39    <div className="card list">
40      <Grid container spacing={4}>
41        {startup.map((startups) => (
42          <Grid key={startups.id} item xs={4}>
43            <Link to={{ pathname: `product/${startups.id}` }}>
44              <CardComponent
45                className="cards"
46                key={startups.id}
47                id={startups.id}
48                image={startups.image}
49                header={startups.header}
50                title={startups.title}
51                category={startups.category}
52                summary={startups.summary}
53              />
54            </Link>
55          </Grid>
56        ))}
57      </Grid>
58    </div>
59  );
60};
61
62export default CardList;
63

I am not sure what's wrong with my map function?

Here is first object of my API response :

1TypeError: startup.map is not a function
2CardList
3C:/personalworkspace/unicorn/front/src/components/CardList.js:30
4  27 | 
5  28 |  return (
6  29 |    <div className="card list">
7> 30 |      <Grid container spacing={4}>
8     | ^  31 |        {startup.map((startups) => (
9  32 |          <Grid key={startups.id} item xs={4}>
10  33 |            <Link to={{ pathname: `product/${startups.id}` }}> 
11import React from 'react';
12import CardComponent from './CardComponent';
13import { Grid } from '@material-ui/core';
14import { Link } from 'react-router-dom';
15import { useState, useEffect } from 'react';
16import StartUpService from './../Services/StartUpService';
17
18const CardList = () => {
19  const [startup, setstartups] = useState([]);
20  
21
22  useEffect(() => {
23    retrieveTutorials();
24  }, []);
25
26  const retrieveTutorials = () => {
27    StartUpService.getAll()
28      .then((response) => {
29        const myData = response.data;
30        setstartups(myData);
31        console.log(myData);
32      })
33      .catch((e) => {
34        console.log(e);
35      });
36  };
37
38  return (
39    <div className="card list">
40      <Grid container spacing={4}>
41        {startup.map((startups) => (
42          <Grid key={startups.id} item xs={4}>
43            <Link to={{ pathname: `product/${startups.id}` }}>
44              <CardComponent
45                className="cards"
46                key={startups.id}
47                id={startups.id}
48                image={startups.image}
49                header={startups.header}
50                title={startups.title}
51                category={startups.category}
52                summary={startups.summary}
53              />
54            </Link>
55          </Grid>
56        ))}
57      </Grid>
58    </div>
59  );
60};
61
62export default CardList;
63{"data":[{"id":1,"header":"First Start Up Header","title":"Title for 
64Startup 1","category":"First Start Up Category","description":"First 
65Start Up description","tags":
66
67["FINTECH"],"card_image":"http://localhost:8000/media/card_images/card1.jpg","logo_image":"http://localhost:8000/media/logo_images/1.png"},
68 
69

ANSWER

Answered 2021-Nov-23 at 23:35

Nothing is wrong with map. startup isn't an array (or other type supporting .map). console.log the api response and you'll see what it really is.

You're code is probably fine the API is just returning data in a format other than what you expect.

Source https://stackoverflow.com/questions/70089068

QUESTION

JSON html string to a new page

Asked 2021-Oct-31 at 13:45

Good afternoon Folks,

I have a JSON file from an API where articles are stored in a long string formatted with HTML format, how can I open them on a new page? If I insert this into a file with an HTML extension then I got a nicely formatted webpage. The data comes as "items" property as a list and I try to get them linkable like this, where the articles are under details_en

1      `https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page_size=61&type=5`
2
3 <div id="article">{{item.details_en}}</div>
4

the actual JSON string looks like this but much longer:

<p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Kuwait City, Kuwait and Dubai, UAE – October 26, 2021<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.<o:p></o:p></span></p><p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"><span lang="EN-US">&nbsp;</span></p>

ANSWER

Answered 2021-Oct-31 at 13:45

Try with v-html directive:

1      `https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page_size=61&amp;type=5`
2
3 &lt;div id=&quot;article&quot;&gt;{{item.details_en}}&lt;/div&gt;
4new Vue({
5  el: '#demo',
6  data() {
7    return {
8      items: [{details_en:'&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Kuwait City, Kuwait and Dubai, UAE – October 26, 2021&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;'}, {details_en:'&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Kuwait City, Kuwait and Dubai, UAE – October 26, 2021&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;'}]
9    }
10  }
11})
12
13Vue.config.productionTip = false
14Vue.config.devtools = false
1      `https://zbeta2.mykuwaitnet.net/backend/en/api/v2/media-center/press-release/?page_size=61&amp;type=5`
2
3 &lt;div id=&quot;article&quot;&gt;{{item.details_en}}&lt;/div&gt;
4new Vue({
5  el: '#demo',
6  data() {
7    return {
8      items: [{details_en:'&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Kuwait City, Kuwait and Dubai, UAE – October 26, 2021&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;'}, {details_en:'&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Kuwait City, Kuwait and Dubai, UAE – October 26, 2021&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;Zain Group, a leading mobile telecom innovator in seven markets across the Middle East and Africa, announces it has been presented with three awards at the prestigious SAMENA Council endorsed MEA Business Magazine Technology Achievement Awards 2021, in the categories of New Technology Leadership for 5G launches in Kuwait and Saudi Arabia; Innovation Collaborations and Partnerships for the launch of Zain Esports; and Ground-breaking Products and Services for the ground-breaking Fintech solution ‘Tamam’ in Saudi Arabia.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(0, 0, 0); text-align: justify;"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;'}]
9    }
10  }
11})
12
13Vue.config.productionTip = false
14Vue.config.devtools = false&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"&gt;&lt;/script&gt;
15&lt;div id="demo"&gt;
16  &lt;div v-for="(item, idx) in items" :key="idx" id="article" v-html="item.details_en"&gt;&lt;/div&gt;
17&lt;/div&gt;

Source https://stackoverflow.com/questions/69787011

QUESTION

Django render many to many attributes after query, display None

Asked 2021-Aug-11 at 14:23

I am using slug to query the model, and render result in HTML. The code is unable to render actual name of region, it just return None

Model

1class Region(models.Model):
2    name = models.CharField(blank=False, unique=True) 
3    def __str__(self):
4        return self.name
5
6class Theme(models.Model):
7    name = models.CharField(blank=False, unique=True) 
8    slug = models.SlugField(default=&quot;&quot;, null=False)
9    def __str__(self):
10        return self.name
11
12class ETF(models.Model):
13    ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True) 
14    full_name = models.CharField(max_length=200, blank=False)
15    # many to many
16    region = models.ManyToManyField(Region)
17    theme = models.ManyToManyField(Theme) 
18

views.py

1class Region(models.Model):
2    name = models.CharField(blank=False, unique=True) 
3    def __str__(self):
4        return self.name
5
6class Theme(models.Model):
7    name = models.CharField(blank=False, unique=True) 
8    slug = models.SlugField(default=&quot;&quot;, null=False)
9    def __str__(self):
10        return self.name
11
12class ETF(models.Model):
13    ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True) 
14    full_name = models.CharField(max_length=200, blank=False)
15    # many to many
16    region = models.ManyToManyField(Region)
17    theme = models.ManyToManyField(Theme) 
18def theme_etf(request, slug): # render ETFs with theme filter   
19    filtered_results = ETF.objects.filter(theme__slug=slug) 
20    return render(request, &quot;etf/list_etf.html&quot;, {
21        &quot;ETFs&quot;: filtered_results   
22    })
23

Part of list_etf.html

1class Region(models.Model):
2    name = models.CharField(blank=False, unique=True) 
3    def __str__(self):
4        return self.name
5
6class Theme(models.Model):
7    name = models.CharField(blank=False, unique=True) 
8    slug = models.SlugField(default=&quot;&quot;, null=False)
9    def __str__(self):
10        return self.name
11
12class ETF(models.Model):
13    ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True) 
14    full_name = models.CharField(max_length=200, blank=False)
15    # many to many
16    region = models.ManyToManyField(Region)
17    theme = models.ManyToManyField(Theme) 
18def theme_etf(request, slug): # render ETFs with theme filter   
19    filtered_results = ETF.objects.filter(theme__slug=slug) 
20    return render(request, &quot;etf/list_etf.html&quot;, {
21        &quot;ETFs&quot;: filtered_results   
22    })
23{% for ETF in ETFs %}            
24  &lt;tr&gt;          
25      &lt;td&gt;{{ ETF.ticker }}&lt;/td&gt;
26      &lt;td&gt;{{ ETF.full_name }}&lt;/td&gt;
27      &lt;td&gt;{{ ETF.region.name }}&lt;/td&gt;  # What should I use in this line
28  &lt;/tr&gt;
29{% endfor %}
30

The code is unable to render actual name of region, it just return None Result

  • Ticker, Name, Region
  • ARKF, ARK Fintech Innovation ETF, None
  • ARKK, ARK Innovation ETF, None
  • KEJI, Global X China Innovation, None

I would like to have this:

  • Ticker, Name, Region
  • ARKF, ARK Fintech Innovation ETF, Global
  • ARKK, ARK Innovation ETF, Global
  • KEJI, Global X China Innovation, China

I have the information in the database. I have checked it in admin.

ANSWER

Answered 2021-Aug-11 at 14:20

Because you have many-to-many relationship, you cannot simply have single values. So, you have to list values.

1class Region(models.Model):
2    name = models.CharField(blank=False, unique=True) 
3    def __str__(self):
4        return self.name
5
6class Theme(models.Model):
7    name = models.CharField(blank=False, unique=True) 
8    slug = models.SlugField(default=&quot;&quot;, null=False)
9    def __str__(self):
10        return self.name
11
12class ETF(models.Model):
13    ticker = models.CharField(max_length=6, blank=False, db_index=True, unique=True) 
14    full_name = models.CharField(max_length=200, blank=False)
15    # many to many
16    region = models.ManyToManyField(Region)
17    theme = models.ManyToManyField(Theme) 
18def theme_etf(request, slug): # render ETFs with theme filter   
19    filtered_results = ETF.objects.filter(theme__slug=slug) 
20    return render(request, &quot;etf/list_etf.html&quot;, {
21        &quot;ETFs&quot;: filtered_results   
22    })
23{% for ETF in ETFs %}            
24  &lt;tr&gt;          
25      &lt;td&gt;{{ ETF.ticker }}&lt;/td&gt;
26      &lt;td&gt;{{ ETF.full_name }}&lt;/td&gt;
27      &lt;td&gt;{{ ETF.region.name }}&lt;/td&gt;  # What should I use in this line
28  &lt;/tr&gt;
29{% endfor %}
30{% for ETF in ETFs %}            
31  &lt;tr&gt;          
32      &lt;td&gt;{{ ETF.ticker }}&lt;/td&gt;
33      &lt;td&gt;{{ ETF.full_name }}&lt;/td&gt;
34      &lt;td&gt;
35          &lt;ol&gt;
36              {% for region in ETF.region %}
37                  &lt;li&gt;{{region.name}}&lt;/li&gt;
38              {% endfor %} 
39          &lt;/ol&gt;
40      &lt;/td&gt; 
41  &lt;/tr&gt;
42{% endfor %}
43

Source https://stackoverflow.com/questions/68743608

QUESTION

Python web scraper, with BeautifulSoup I am having problem with my link , the link is now going to headline story but redirecting to the archives page

Asked 2021-Aug-02 at 13:19

The link is redirecting me to an archives page with other top stories https://www.coindesk.com/news/babel-finance-bets-on-longtime-fintech-hand-to-help-navigate-regulatory-landscape. The tag news on the link between .com and babel should not be there as I believe it is that which is redirecting the news headline to another page.

1from bs4 import BeautifulSoup
2import requests
3
4
5base_url ='https://www.coindesk.com/news'
6
7source = requests.get(base_url).text
8
9soup = BeautifulSoup(source, &quot;html.parser&quot;)       
10    
11    
12articles = soup.find_all(class_ = 'list-item-card post')
13    
14#print(len(articles))
15#print(articles) 
16
17    
18for article in articles:
19      
20    headline = article.h4.text.strip()
21    link = base_url + article.find_all(&quot;a&quot;)[1][&quot;href&quot;]
22    text = article.find(class_=&quot;card-text&quot;).text.strip()
23    img_url = base_url+article.picture.img['src']
24            
25    print(headline)
26    print(link)
27    print(text)
28    print(&quot;Image &quot; + img_url)
29    ```
30
31

ANSWER

Answered 2021-Aug-02 at 13:19

The error happens because you are concatinating your base link (which already includes /news/) to an absolute url

To prevent this, you can use urllib.parse.urljoin()

In your example this should fix the issue:

1from bs4 import BeautifulSoup
2import requests
3
4
5base_url ='https://www.coindesk.com/news'
6
7source = requests.get(base_url).text
8
9soup = BeautifulSoup(source, &quot;html.parser&quot;)       
10    
11    
12articles = soup.find_all(class_ = 'list-item-card post')
13    
14#print(len(articles))
15#print(articles) 
16
17    
18for article in articles:
19      
20    headline = article.h4.text.strip()
21    link = base_url + article.find_all(&quot;a&quot;)[1][&quot;href&quot;]
22    text = article.find(class_=&quot;card-text&quot;).text.strip()
23    img_url = base_url+article.picture.img['src']
24            
25    print(headline)
26    print(link)
27    print(text)
28    print(&quot;Image &quot; + img_url)
29    ```
30
31from urllib.parse import urljoin
32
33link = urljoin(base_url, article.find_all(&quot;a&quot;)[1][&quot;href&quot;])
34

Source https://stackoverflow.com/questions/68622122

QUESTION

Trying to get property 'title' of non-object Curl PHP

Asked 2021-Apr-28 at 11:05

I have this Code which I am Using to Fetch Jobs From the Api:

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37

I am trying to access these values:

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43

I am Getting these warnings :

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44

on line 31

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45

on line 31

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46

on line 31

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47

on line 31

Where am I Doing wrong???

if I do var_dump($result);

then the output is this :

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48  [&quot;__CLASS__&quot;]=&gt;
49  string(39) &quot;Adzuna::API::Response::JobSearchResults&quot;
50  [&quot;results&quot;]=&gt;
51  array(20) {
52    [0]=&gt;
53    object(stdClass)#2 (15) {
54      [&quot;description&quot;]=&gt;
55      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
56      [&quot;company&quot;]=&gt;
57      object(stdClass)#3 (2) {
58        [&quot;display_name&quot;]=&gt;
59        string(7) &quot;Ardotec&quot;
60        [&quot;__CLASS__&quot;]=&gt;
61        string(30) &quot;Adzuna::API::Response::Company&quot;
62      }
63      [&quot;redirect_url&quot;]=&gt;
64      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
65      [&quot;created&quot;]=&gt;
66      string(20) &quot;2021-04-27T06:43:41Z&quot;
67      [&quot;__CLASS__&quot;]=&gt;
68      string(26) &quot;Adzuna::API::Response::Job&quot;
69      [&quot;salary_is_predicted&quot;]=&gt;
70      string(1) &quot;0&quot;
71      [&quot;longitude&quot;]=&gt;
72      float(-0.02806)
73      [&quot;salary_min&quot;]=&gt;
74      int(45000)
75      [&quot;category&quot;]=&gt;
76      object(stdClass)#4 (3) {
77        [&quot;__CLASS__&quot;]=&gt;
78        string(31) &quot;Adzuna::API::Response::Category&quot;
79        [&quot;tag&quot;]=&gt;
80        string(7) &quot;it-jobs&quot;
81        [&quot;label&quot;]=&gt;
82        string(7) &quot;IT Jobs&quot;
83      }
84      [&quot;latitude&quot;]=&gt;
85      float(51.451818)
86      [&quot;title&quot;]=&gt;
87      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
88      [&quot;id&quot;]=&gt;
89      string(10) &quot;2143941919&quot;
90      [&quot;location&quot;]=&gt;
91      object(stdClass)#5 (3) {
92        [&quot;__CLASS__&quot;]=&gt;
93        string(31) &quot;Adzuna::API::Response::Location&quot;
94        [&quot;area&quot;]=&gt;
95        array(3) {
96          [0]=&gt;
97          string(2) &quot;UK&quot;
98          [1]=&gt;
99          string(6) &quot;London&quot;
100          [2]=&gt;
101          string(17) &quot;South East London&quot;
102        }
103        [&quot;display_name&quot;]=&gt;
104        string(25) &quot;South East London, London&quot;
105      }
106      [&quot;salary_max&quot;]=&gt;
107      int(65000)
108      [&quot;adref&quot;]=&gt;
109      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg&quot;
110    }
111    [1]=&gt;
112    object(stdClass)#6 (15) {
113      [&quot;__CLASS__&quot;]=&gt;
114      string(26) &quot;Adzuna::API::Response::Job&quot;
115      [&quot;created&quot;]=&gt;
116      string(20) &quot;2021-04-20T22:25:33Z&quot;
117      [&quot;salary_is_predicted&quot;]=&gt;
118      string(1) &quot;0&quot;
119      [&quot;redirect_url&quot;]=&gt;
120      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
121      [&quot;salary_min&quot;]=&gt;
122      int(30000)
123      [&quot;longitude&quot;]=&gt;
124      float(0.523168)
125      [&quot;company&quot;]=&gt;
126      object(stdClass)#7 (2) {
127        [&quot;__CLASS__&quot;]=&gt;
128        string(30) &quot;Adzuna::API::Response::Company&quot;
129        [&quot;display_name&quot;]=&gt;
130        string(12) &quot;White Stores&quot;
131      }
132      [&quot;description&quot;]=&gt;
133      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
134      [&quot;location&quot;]=&gt;
135      object(stdClass)#8 (3) {
136        [&quot;area&quot;]=&gt;
137        array(4) {
138          [0]=&gt;
139          string(2) &quot;UK&quot;
140          [1]=&gt;
141          string(15) &quot;Eastern England&quot;
142          [2]=&gt;
143          string(5) &quot;Essex&quot;
144          [3]=&gt;
145          string(8) &quot;Wickford&quot;
146        }
147        [&quot;__CLASS__&quot;]=&gt;
148        string(31) &quot;Adzuna::API::Response::Location&quot;
149        [&quot;display_name&quot;]=&gt;
150        string(15) &quot;Wickford, Essex&quot;
151      }
152      [&quot;id&quot;]=&gt;
153      string(10) &quot;2129749481&quot;
154      [&quot;adref&quot;]=&gt;
155      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM&quot;
156      [&quot;salary_max&quot;]=&gt;
157      int(35000)
158      [&quot;category&quot;]=&gt;
159      object(stdClass)#9 (3) {
160        [&quot;__CLASS__&quot;]=&gt;
161        string(31) &quot;Adzuna::API::Response::Category&quot;
162        [&quot;tag&quot;]=&gt;
163        string(7) &quot;it-jobs&quot;
164        [&quot;label&quot;]=&gt;
165        string(7) &quot;IT Jobs&quot;
166      }
167      [&quot;latitude&quot;]=&gt;
168      float(51.6106)
169      [&quot;title&quot;]=&gt;
170      string(30) &quot;PHP Developer&quot;
171    }
172

this is the result above I posted some of it as i am not able to post fully results here ...

if I do this:

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48  [&quot;__CLASS__&quot;]=&gt;
49  string(39) &quot;Adzuna::API::Response::JobSearchResults&quot;
50  [&quot;results&quot;]=&gt;
51  array(20) {
52    [0]=&gt;
53    object(stdClass)#2 (15) {
54      [&quot;description&quot;]=&gt;
55      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
56      [&quot;company&quot;]=&gt;
57      object(stdClass)#3 (2) {
58        [&quot;display_name&quot;]=&gt;
59        string(7) &quot;Ardotec&quot;
60        [&quot;__CLASS__&quot;]=&gt;
61        string(30) &quot;Adzuna::API::Response::Company&quot;
62      }
63      [&quot;redirect_url&quot;]=&gt;
64      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
65      [&quot;created&quot;]=&gt;
66      string(20) &quot;2021-04-27T06:43:41Z&quot;
67      [&quot;__CLASS__&quot;]=&gt;
68      string(26) &quot;Adzuna::API::Response::Job&quot;
69      [&quot;salary_is_predicted&quot;]=&gt;
70      string(1) &quot;0&quot;
71      [&quot;longitude&quot;]=&gt;
72      float(-0.02806)
73      [&quot;salary_min&quot;]=&gt;
74      int(45000)
75      [&quot;category&quot;]=&gt;
76      object(stdClass)#4 (3) {
77        [&quot;__CLASS__&quot;]=&gt;
78        string(31) &quot;Adzuna::API::Response::Category&quot;
79        [&quot;tag&quot;]=&gt;
80        string(7) &quot;it-jobs&quot;
81        [&quot;label&quot;]=&gt;
82        string(7) &quot;IT Jobs&quot;
83      }
84      [&quot;latitude&quot;]=&gt;
85      float(51.451818)
86      [&quot;title&quot;]=&gt;
87      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
88      [&quot;id&quot;]=&gt;
89      string(10) &quot;2143941919&quot;
90      [&quot;location&quot;]=&gt;
91      object(stdClass)#5 (3) {
92        [&quot;__CLASS__&quot;]=&gt;
93        string(31) &quot;Adzuna::API::Response::Location&quot;
94        [&quot;area&quot;]=&gt;
95        array(3) {
96          [0]=&gt;
97          string(2) &quot;UK&quot;
98          [1]=&gt;
99          string(6) &quot;London&quot;
100          [2]=&gt;
101          string(17) &quot;South East London&quot;
102        }
103        [&quot;display_name&quot;]=&gt;
104        string(25) &quot;South East London, London&quot;
105      }
106      [&quot;salary_max&quot;]=&gt;
107      int(65000)
108      [&quot;adref&quot;]=&gt;
109      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg&quot;
110    }
111    [1]=&gt;
112    object(stdClass)#6 (15) {
113      [&quot;__CLASS__&quot;]=&gt;
114      string(26) &quot;Adzuna::API::Response::Job&quot;
115      [&quot;created&quot;]=&gt;
116      string(20) &quot;2021-04-20T22:25:33Z&quot;
117      [&quot;salary_is_predicted&quot;]=&gt;
118      string(1) &quot;0&quot;
119      [&quot;redirect_url&quot;]=&gt;
120      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
121      [&quot;salary_min&quot;]=&gt;
122      int(30000)
123      [&quot;longitude&quot;]=&gt;
124      float(0.523168)
125      [&quot;company&quot;]=&gt;
126      object(stdClass)#7 (2) {
127        [&quot;__CLASS__&quot;]=&gt;
128        string(30) &quot;Adzuna::API::Response::Company&quot;
129        [&quot;display_name&quot;]=&gt;
130        string(12) &quot;White Stores&quot;
131      }
132      [&quot;description&quot;]=&gt;
133      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
134      [&quot;location&quot;]=&gt;
135      object(stdClass)#8 (3) {
136        [&quot;area&quot;]=&gt;
137        array(4) {
138          [0]=&gt;
139          string(2) &quot;UK&quot;
140          [1]=&gt;
141          string(15) &quot;Eastern England&quot;
142          [2]=&gt;
143          string(5) &quot;Essex&quot;
144          [3]=&gt;
145          string(8) &quot;Wickford&quot;
146        }
147        [&quot;__CLASS__&quot;]=&gt;
148        string(31) &quot;Adzuna::API::Response::Location&quot;
149        [&quot;display_name&quot;]=&gt;
150        string(15) &quot;Wickford, Essex&quot;
151      }
152      [&quot;id&quot;]=&gt;
153      string(10) &quot;2129749481&quot;
154      [&quot;adref&quot;]=&gt;
155      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM&quot;
156      [&quot;salary_max&quot;]=&gt;
157      int(35000)
158      [&quot;category&quot;]=&gt;
159      object(stdClass)#9 (3) {
160        [&quot;__CLASS__&quot;]=&gt;
161        string(31) &quot;Adzuna::API::Response::Category&quot;
162        [&quot;tag&quot;]=&gt;
163        string(7) &quot;it-jobs&quot;
164        [&quot;label&quot;]=&gt;
165        string(7) &quot;IT Jobs&quot;
166      }
167      [&quot;latitude&quot;]=&gt;
168      float(51.6106)
169      [&quot;title&quot;]=&gt;
170      string(30) &quot;PHP Developer&quot;
171    }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo &quot;&lt;pre&gt;&quot;;
179
180
181var_dump($result);
182

the output is like this ...

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48  [&quot;__CLASS__&quot;]=&gt;
49  string(39) &quot;Adzuna::API::Response::JobSearchResults&quot;
50  [&quot;results&quot;]=&gt;
51  array(20) {
52    [0]=&gt;
53    object(stdClass)#2 (15) {
54      [&quot;description&quot;]=&gt;
55      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
56      [&quot;company&quot;]=&gt;
57      object(stdClass)#3 (2) {
58        [&quot;display_name&quot;]=&gt;
59        string(7) &quot;Ardotec&quot;
60        [&quot;__CLASS__&quot;]=&gt;
61        string(30) &quot;Adzuna::API::Response::Company&quot;
62      }
63      [&quot;redirect_url&quot;]=&gt;
64      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
65      [&quot;created&quot;]=&gt;
66      string(20) &quot;2021-04-27T06:43:41Z&quot;
67      [&quot;__CLASS__&quot;]=&gt;
68      string(26) &quot;Adzuna::API::Response::Job&quot;
69      [&quot;salary_is_predicted&quot;]=&gt;
70      string(1) &quot;0&quot;
71      [&quot;longitude&quot;]=&gt;
72      float(-0.02806)
73      [&quot;salary_min&quot;]=&gt;
74      int(45000)
75      [&quot;category&quot;]=&gt;
76      object(stdClass)#4 (3) {
77        [&quot;__CLASS__&quot;]=&gt;
78        string(31) &quot;Adzuna::API::Response::Category&quot;
79        [&quot;tag&quot;]=&gt;
80        string(7) &quot;it-jobs&quot;
81        [&quot;label&quot;]=&gt;
82        string(7) &quot;IT Jobs&quot;
83      }
84      [&quot;latitude&quot;]=&gt;
85      float(51.451818)
86      [&quot;title&quot;]=&gt;
87      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
88      [&quot;id&quot;]=&gt;
89      string(10) &quot;2143941919&quot;
90      [&quot;location&quot;]=&gt;
91      object(stdClass)#5 (3) {
92        [&quot;__CLASS__&quot;]=&gt;
93        string(31) &quot;Adzuna::API::Response::Location&quot;
94        [&quot;area&quot;]=&gt;
95        array(3) {
96          [0]=&gt;
97          string(2) &quot;UK&quot;
98          [1]=&gt;
99          string(6) &quot;London&quot;
100          [2]=&gt;
101          string(17) &quot;South East London&quot;
102        }
103        [&quot;display_name&quot;]=&gt;
104        string(25) &quot;South East London, London&quot;
105      }
106      [&quot;salary_max&quot;]=&gt;
107      int(65000)
108      [&quot;adref&quot;]=&gt;
109      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg&quot;
110    }
111    [1]=&gt;
112    object(stdClass)#6 (15) {
113      [&quot;__CLASS__&quot;]=&gt;
114      string(26) &quot;Adzuna::API::Response::Job&quot;
115      [&quot;created&quot;]=&gt;
116      string(20) &quot;2021-04-20T22:25:33Z&quot;
117      [&quot;salary_is_predicted&quot;]=&gt;
118      string(1) &quot;0&quot;
119      [&quot;redirect_url&quot;]=&gt;
120      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
121      [&quot;salary_min&quot;]=&gt;
122      int(30000)
123      [&quot;longitude&quot;]=&gt;
124      float(0.523168)
125      [&quot;company&quot;]=&gt;
126      object(stdClass)#7 (2) {
127        [&quot;__CLASS__&quot;]=&gt;
128        string(30) &quot;Adzuna::API::Response::Company&quot;
129        [&quot;display_name&quot;]=&gt;
130        string(12) &quot;White Stores&quot;
131      }
132      [&quot;description&quot;]=&gt;
133      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
134      [&quot;location&quot;]=&gt;
135      object(stdClass)#8 (3) {
136        [&quot;area&quot;]=&gt;
137        array(4) {
138          [0]=&gt;
139          string(2) &quot;UK&quot;
140          [1]=&gt;
141          string(15) &quot;Eastern England&quot;
142          [2]=&gt;
143          string(5) &quot;Essex&quot;
144          [3]=&gt;
145          string(8) &quot;Wickford&quot;
146        }
147        [&quot;__CLASS__&quot;]=&gt;
148        string(31) &quot;Adzuna::API::Response::Location&quot;
149        [&quot;display_name&quot;]=&gt;
150        string(15) &quot;Wickford, Essex&quot;
151      }
152      [&quot;id&quot;]=&gt;
153      string(10) &quot;2129749481&quot;
154      [&quot;adref&quot;]=&gt;
155      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM&quot;
156      [&quot;salary_max&quot;]=&gt;
157      int(35000)
158      [&quot;category&quot;]=&gt;
159      object(stdClass)#9 (3) {
160        [&quot;__CLASS__&quot;]=&gt;
161        string(31) &quot;Adzuna::API::Response::Category&quot;
162        [&quot;tag&quot;]=&gt;
163        string(7) &quot;it-jobs&quot;
164        [&quot;label&quot;]=&gt;
165        string(7) &quot;IT Jobs&quot;
166      }
167      [&quot;latitude&quot;]=&gt;
168      float(51.6106)
169      [&quot;title&quot;]=&gt;
170      string(30) &quot;PHP Developer&quot;
171    }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo &quot;&lt;pre&gt;&quot;;
179
180
181var_dump($result);
182array(4) {   [&quot;mean&quot;]=&gt;   float(45274.4)   [&quot;count&quot;]=&gt;   int(6140)   [&quot;__CLASS__&quot;]=&gt;   string(39) &quot;Adzuna::API::Response::JobSearchResults&quot; [&quot;results&quot;]=&gt;   array(20) {
183    [0]=&gt;
184    array(15) {
185      [&quot;salary_min&quot;]=&gt;
186      int(45000)
187      [&quot;location&quot;]=&gt;
188      array(3) {
189        [&quot;area&quot;]=&gt;
190        array(3) {
191          [0]=&gt;
192          string(2) &quot;UK&quot;
193          [1]=&gt;
194          string(6) &quot;London&quot;
195          [2]=&gt;
196          string(17) &quot;South East London&quot;
197        }
198        [&quot;display_name&quot;]=&gt;
199        string(25) &quot;South East London, London&quot;
200        [&quot;__CLASS__&quot;]=&gt;
201        string(31) &quot;Adzuna::API::Response::Location&quot;
202      }
203      [&quot;salary_max&quot;]=&gt;
204      int(65000)
205      [&quot;description&quot;]=&gt;
206      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
207      [&quot;__CLASS__&quot;]=&gt;
208      string(26) &quot;Adzuna::API::Response::Job&quot;
209      [&quot;longitude&quot;]=&gt;
210      float(-0.02806)
211      [&quot;title&quot;]=&gt;
212      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
213      [&quot;adref&quot;]=&gt;
214      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMTQzOTQxOTE5In0.xdtRRI8U0hAlL3q9NvVfXP8yZ_EWoB7o3ZUbN4856u0&quot;
215      [&quot;category&quot;]=&gt;
216      array(3) {
217        [&quot;label&quot;]=&gt;
218        string(7) &quot;IT Jobs&quot;
219        [&quot;tag&quot;]=&gt;
220        string(7) &quot;it-jobs&quot;
221        [&quot;__CLASS__&quot;]=&gt;
222        string(31) &quot;Adzuna::API::Response::Category&quot;
223      }
224      [&quot;redirect_url&quot;]=&gt;
225      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
226      [&quot;created&quot;]=&gt;
227      string(20) &quot;2021-04-27T06:43:41Z&quot;
228      [&quot;latitude&quot;]=&gt;
229      float(51.451818)
230      [&quot;id&quot;]=&gt;
231      string(10) &quot;2143941919&quot;
232      [&quot;salary_is_predicted&quot;]=&gt;
233      string(1) &quot;0&quot;
234      [&quot;company&quot;]=&gt;
235      array(2) {
236        [&quot;display_name&quot;]=&gt;
237        string(7) &quot;Ardotec&quot;
238        [&quot;__CLASS__&quot;]=&gt;
239        string(30) &quot;Adzuna::API::Response::Company&quot;
240      }
241    }
242    [1]=&gt;
243    array(15) {
244      [&quot;salary_is_predicted&quot;]=&gt;
245      string(1) &quot;0&quot;
246      [&quot;company&quot;]=&gt;
247      array(2) {
248        [&quot;display_name&quot;]=&gt;
249        string(12) &quot;White Stores&quot;
250        [&quot;__CLASS__&quot;]=&gt;
251        string(30) &quot;Adzuna::API::Response::Company&quot;
252      }
253      [&quot;id&quot;]=&gt;
254      string(10) &quot;2129749481&quot;
255      [&quot;latitude&quot;]=&gt;
256      float(51.6106)
257      [&quot;created&quot;]=&gt;
258      string(20) &quot;2021-04-20T22:25:33Z&quot;
259      [&quot;redirect_url&quot;]=&gt;
260      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
261      [&quot;category&quot;]=&gt;
262      array(3) {
263        [&quot;tag&quot;]=&gt;
264        string(7) &quot;it-jobs&quot;
265        [&quot;__CLASS__&quot;]=&gt;
266        string(31) &quot;Adzuna::API::Response::Category&quot;
267        [&quot;label&quot;]=&gt;
268        string(7) &quot;IT Jobs&quot;
269      }
270      [&quot;adref&quot;]=&gt;
271      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.LbCbnV_bIM1qvNR1Dy3QDrpk7GbrSimhQ9PBXKlYdHQ&quot;
272      [&quot;title&quot;]=&gt;
273      string(30) &quot;PHP Developer&quot;
274      [&quot;longitude&quot;]=&gt;
275      float(0.523168)
276      [&quot;description&quot;]=&gt;
277      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
278      [&quot;__CLASS__&quot;]=&gt;
279      string(26) &quot;Adzuna::API::Response::Job&quot;
280      [&quot;salary_max&quot;]=&gt;
281      int(35000)
282      [&quot;location&quot;]=&gt;
283      array(3) {
284        [&quot;display_name&quot;]=&gt;
285        string(15) &quot;Wickford, Essex&quot;
286        [&quot;__CLASS__&quot;]=&gt;
287        string(31) &quot;Adzuna::API::Response::Location&quot;
288        [&quot;area&quot;]=&gt;
289        array(4) {
290          [0]=&gt;
291          string(2) &quot;UK&quot;
292          [1]=&gt;
293          string(15) &quot;Eastern England&quot;
294          [2]=&gt;
295          string(5) &quot;Essex&quot;
296          [3]=&gt;
297          string(8) &quot;Wickford&quot;
298        }
299      }
300      [&quot;salary_min&quot;]=&gt;
301      int(30000)
302    }
303    [2]=&gt;
304    array(15) {
305      [&quot;title&quot;]=&gt;
306      string(30) &quot;PHP developer&quot;
307      [&quot;longitude&quot;]=&gt;
308      float(-2.29854)
309      [&quot;description&quot;]=&gt;
310      string(419) &quot;PHP developer - Manchester - £32,000 A PHP developer is required to join a well-established, innovative and award-winning business based in north Manchester as they expand ...  the development team. Having serviced businesses from small corner shops, to blue chip organisations across the UK, the successful PHP developer will have the opportunity to work on some ...&quot;
311      [&quot;__CLASS__&quot;]=&gt;
312      string(26) &quot;Adzuna::API::Response::Job&quot;
313      [&quot;salary_max&quot;]=&gt;
314      int(32000)
315      [&quot;location&quot;]=&gt;
316      array(3) {
317        [&quot;display_name&quot;]=&gt;
318        string(24) &quot;Bury, Greater Manchester&quot;
319        [&quot;__CLASS__&quot;]=&gt;
320        string(31) &quot;Adzuna::API::Response::Location&quot;
321        [&quot;area&quot;]=&gt;
322        array(4) {
323          [0]=&gt;
324          string(2) &quot;UK&quot;
325          [1]=&gt;
326          string(18) &quot;North West England&quot;
327          [2]=&gt;
328          string(18) &quot;Greater Manchester&quot;
329          [3]=&gt;
330          string(4) &quot;Bury&quot;
331        }
332      }
333      [&quot;salary_min&quot;]=&gt;
334      int(28000)
335      [&quot;salary_is_predicted&quot;]=&gt;
336      string(1) &quot;0&quot;
337      [&quot;company&quot;]=&gt;
338      array(2) {
339        [&quot;display_name&quot;]=&gt;
340        string(6) &quot;Capita&quot;
341        [&quot;__CLASS__&quot;]=&gt;
342        string(30) &quot;Adzuna::API::Response::Company&quot;
343      }
344      [&quot;id&quot;]=&gt;
345      string(10) &quot;2102200703&quot;
346      [&quot;latitude&quot;]=&gt;
347      float(53.593498)
348      [&quot;redirect_url&quot;]=&gt;
349      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2102200703?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=395C49C57A5FC0605CD718A9D5FDF04E985F3780&quot;
350      [&quot;created&quot;]=&gt;
351      string(20) &quot;2021-04-06T18:58:11Z&quot;
352      [&quot;category&quot;]=&gt;
353      array(3) {
354        [&quot;label&quot;]=&gt;
355        string(7) &quot;IT Jobs&quot;
356        [&quot;tag&quot;]=&gt;
357        string(7) &quot;it-jobs&quot;
358        [&quot;__CLASS__&quot;]=&gt;
359        string(31) &quot;Adzuna::API::Response::Category&quot;
360      }
361      [&quot;adref&quot;]=&gt;
362      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEwMjIwMDcwMyIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.OGD0UUmtvmcN-BDauzaIIpEzqg2TwPOWmIen6AldiG0&quot;
363    }
364    [3]=&gt;
365    array(13) {
366      [&quot;location&quot;]=&gt;
367      array(3) {
368        [&quot;__CLASS__&quot;]=&gt;
369        string(31) &quot;Adzuna::API::Response::Location&quot;
370        [&quot;display_name&quot;]=&gt;
371        string(2) &quot;UK&quot;
372        [&quot;area&quot;]=&gt;
373        array(1) {
374          [0]=&gt;
375          string(2) &quot;UK&quot;
376        }
377      }
378      [&quot;salary_min&quot;]=&gt;
379      int(0)
380      [&quot;description&quot;]=&gt;
381      string(408) &quot;Mid / Senior PHP Developer technologi are looking for a capable, knowledgeable, motivated individual to assist in developing the software that supports the service proposition ...  revolution to the UK card payments industry focusing on system innovation and service excellence. Salary: Up to £65,000 Job Type: Full Time Responsibilities of the Mid/Senior PHP Developer ...&quot;
382      [&quot;__CLASS__&quot;]=&gt;
383      string(26) &quot;Adzuna::API::Response::Job&quot;
384      [&quot;salary_max&quot;]=&gt;
385      int(65000)
386      [&quot;title&quot;]=&gt;
387      string(30) &quot;PHP Developer&quot;
388      [&quot;category&quot;]=&gt;
389      array(3) {
390        [&quot;label&quot;]=&gt;
391        string(7) &quot;IT Jobs&quot;
392        [&quot;__CLASS__&quot;]=&gt;
393        string(31) &quot;Adzuna::API::Response::Category&quot;
394        [&quot;tag&quot;]=&gt;
395        string(7) &quot;it-jobs&quot;
396      }
397      [&quot;adref&quot;]=&gt;
398      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMDkxNDMwNDMwIn0.zhUM-Aw2XdL-gVddZ6279px_pj3gs6ZWr_WKXpfkoX8&quot;
399      [&quot;redirect_url&quot;]=&gt;
400      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2091430430?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=2720D4577AE58EBCB28D1478075CC47866B3CF33&quot;
401      [&quot;created&quot;]=&gt;
402      string(20) &quot;2021-04-01T18:21:44Z&quot;
403      [&quot;id&quot;]=&gt;
404      string(10) &quot;2091430430&quot;
405      [&quot;company&quot;]=&gt;
406      array(2) {
407        [&quot;display_name&quot;]=&gt;
408        string(10) &quot;technologi&quot;
409        [&quot;__CLASS__&quot;]=&gt;
410        string(30) &quot;Adzuna::API::Response::Company&quot;
411      }
412      [&quot;salary_is_predicted&quot;]=&gt;
413      string(1) &quot;0&quot;
414    }
415

Thanks In Advance..

ANSWER

Answered 2021-Apr-28 at 11:05

so it becomes like this

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48  [&quot;__CLASS__&quot;]=&gt;
49  string(39) &quot;Adzuna::API::Response::JobSearchResults&quot;
50  [&quot;results&quot;]=&gt;
51  array(20) {
52    [0]=&gt;
53    object(stdClass)#2 (15) {
54      [&quot;description&quot;]=&gt;
55      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
56      [&quot;company&quot;]=&gt;
57      object(stdClass)#3 (2) {
58        [&quot;display_name&quot;]=&gt;
59        string(7) &quot;Ardotec&quot;
60        [&quot;__CLASS__&quot;]=&gt;
61        string(30) &quot;Adzuna::API::Response::Company&quot;
62      }
63      [&quot;redirect_url&quot;]=&gt;
64      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
65      [&quot;created&quot;]=&gt;
66      string(20) &quot;2021-04-27T06:43:41Z&quot;
67      [&quot;__CLASS__&quot;]=&gt;
68      string(26) &quot;Adzuna::API::Response::Job&quot;
69      [&quot;salary_is_predicted&quot;]=&gt;
70      string(1) &quot;0&quot;
71      [&quot;longitude&quot;]=&gt;
72      float(-0.02806)
73      [&quot;salary_min&quot;]=&gt;
74      int(45000)
75      [&quot;category&quot;]=&gt;
76      object(stdClass)#4 (3) {
77        [&quot;__CLASS__&quot;]=&gt;
78        string(31) &quot;Adzuna::API::Response::Category&quot;
79        [&quot;tag&quot;]=&gt;
80        string(7) &quot;it-jobs&quot;
81        [&quot;label&quot;]=&gt;
82        string(7) &quot;IT Jobs&quot;
83      }
84      [&quot;latitude&quot;]=&gt;
85      float(51.451818)
86      [&quot;title&quot;]=&gt;
87      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
88      [&quot;id&quot;]=&gt;
89      string(10) &quot;2143941919&quot;
90      [&quot;location&quot;]=&gt;
91      object(stdClass)#5 (3) {
92        [&quot;__CLASS__&quot;]=&gt;
93        string(31) &quot;Adzuna::API::Response::Location&quot;
94        [&quot;area&quot;]=&gt;
95        array(3) {
96          [0]=&gt;
97          string(2) &quot;UK&quot;
98          [1]=&gt;
99          string(6) &quot;London&quot;
100          [2]=&gt;
101          string(17) &quot;South East London&quot;
102        }
103        [&quot;display_name&quot;]=&gt;
104        string(25) &quot;South East London, London&quot;
105      }
106      [&quot;salary_max&quot;]=&gt;
107      int(65000)
108      [&quot;adref&quot;]=&gt;
109      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg&quot;
110    }
111    [1]=&gt;
112    object(stdClass)#6 (15) {
113      [&quot;__CLASS__&quot;]=&gt;
114      string(26) &quot;Adzuna::API::Response::Job&quot;
115      [&quot;created&quot;]=&gt;
116      string(20) &quot;2021-04-20T22:25:33Z&quot;
117      [&quot;salary_is_predicted&quot;]=&gt;
118      string(1) &quot;0&quot;
119      [&quot;redirect_url&quot;]=&gt;
120      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
121      [&quot;salary_min&quot;]=&gt;
122      int(30000)
123      [&quot;longitude&quot;]=&gt;
124      float(0.523168)
125      [&quot;company&quot;]=&gt;
126      object(stdClass)#7 (2) {
127        [&quot;__CLASS__&quot;]=&gt;
128        string(30) &quot;Adzuna::API::Response::Company&quot;
129        [&quot;display_name&quot;]=&gt;
130        string(12) &quot;White Stores&quot;
131      }
132      [&quot;description&quot;]=&gt;
133      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
134      [&quot;location&quot;]=&gt;
135      object(stdClass)#8 (3) {
136        [&quot;area&quot;]=&gt;
137        array(4) {
138          [0]=&gt;
139          string(2) &quot;UK&quot;
140          [1]=&gt;
141          string(15) &quot;Eastern England&quot;
142          [2]=&gt;
143          string(5) &quot;Essex&quot;
144          [3]=&gt;
145          string(8) &quot;Wickford&quot;
146        }
147        [&quot;__CLASS__&quot;]=&gt;
148        string(31) &quot;Adzuna::API::Response::Location&quot;
149        [&quot;display_name&quot;]=&gt;
150        string(15) &quot;Wickford, Essex&quot;
151      }
152      [&quot;id&quot;]=&gt;
153      string(10) &quot;2129749481&quot;
154      [&quot;adref&quot;]=&gt;
155      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM&quot;
156      [&quot;salary_max&quot;]=&gt;
157      int(35000)
158      [&quot;category&quot;]=&gt;
159      object(stdClass)#9 (3) {
160        [&quot;__CLASS__&quot;]=&gt;
161        string(31) &quot;Adzuna::API::Response::Category&quot;
162        [&quot;tag&quot;]=&gt;
163        string(7) &quot;it-jobs&quot;
164        [&quot;label&quot;]=&gt;
165        string(7) &quot;IT Jobs&quot;
166      }
167      [&quot;latitude&quot;]=&gt;
168      float(51.6106)
169      [&quot;title&quot;]=&gt;
170      string(30) &quot;PHP Developer&quot;
171    }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo &quot;&lt;pre&gt;&quot;;
179
180
181var_dump($result);
182array(4) {   [&quot;mean&quot;]=&gt;   float(45274.4)   [&quot;count&quot;]=&gt;   int(6140)   [&quot;__CLASS__&quot;]=&gt;   string(39) &quot;Adzuna::API::Response::JobSearchResults&quot; [&quot;results&quot;]=&gt;   array(20) {
183    [0]=&gt;
184    array(15) {
185      [&quot;salary_min&quot;]=&gt;
186      int(45000)
187      [&quot;location&quot;]=&gt;
188      array(3) {
189        [&quot;area&quot;]=&gt;
190        array(3) {
191          [0]=&gt;
192          string(2) &quot;UK&quot;
193          [1]=&gt;
194          string(6) &quot;London&quot;
195          [2]=&gt;
196          string(17) &quot;South East London&quot;
197        }
198        [&quot;display_name&quot;]=&gt;
199        string(25) &quot;South East London, London&quot;
200        [&quot;__CLASS__&quot;]=&gt;
201        string(31) &quot;Adzuna::API::Response::Location&quot;
202      }
203      [&quot;salary_max&quot;]=&gt;
204      int(65000)
205      [&quot;description&quot;]=&gt;
206      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
207      [&quot;__CLASS__&quot;]=&gt;
208      string(26) &quot;Adzuna::API::Response::Job&quot;
209      [&quot;longitude&quot;]=&gt;
210      float(-0.02806)
211      [&quot;title&quot;]=&gt;
212      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
213      [&quot;adref&quot;]=&gt;
214      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMTQzOTQxOTE5In0.xdtRRI8U0hAlL3q9NvVfXP8yZ_EWoB7o3ZUbN4856u0&quot;
215      [&quot;category&quot;]=&gt;
216      array(3) {
217        [&quot;label&quot;]=&gt;
218        string(7) &quot;IT Jobs&quot;
219        [&quot;tag&quot;]=&gt;
220        string(7) &quot;it-jobs&quot;
221        [&quot;__CLASS__&quot;]=&gt;
222        string(31) &quot;Adzuna::API::Response::Category&quot;
223      }
224      [&quot;redirect_url&quot;]=&gt;
225      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
226      [&quot;created&quot;]=&gt;
227      string(20) &quot;2021-04-27T06:43:41Z&quot;
228      [&quot;latitude&quot;]=&gt;
229      float(51.451818)
230      [&quot;id&quot;]=&gt;
231      string(10) &quot;2143941919&quot;
232      [&quot;salary_is_predicted&quot;]=&gt;
233      string(1) &quot;0&quot;
234      [&quot;company&quot;]=&gt;
235      array(2) {
236        [&quot;display_name&quot;]=&gt;
237        string(7) &quot;Ardotec&quot;
238        [&quot;__CLASS__&quot;]=&gt;
239        string(30) &quot;Adzuna::API::Response::Company&quot;
240      }
241    }
242    [1]=&gt;
243    array(15) {
244      [&quot;salary_is_predicted&quot;]=&gt;
245      string(1) &quot;0&quot;
246      [&quot;company&quot;]=&gt;
247      array(2) {
248        [&quot;display_name&quot;]=&gt;
249        string(12) &quot;White Stores&quot;
250        [&quot;__CLASS__&quot;]=&gt;
251        string(30) &quot;Adzuna::API::Response::Company&quot;
252      }
253      [&quot;id&quot;]=&gt;
254      string(10) &quot;2129749481&quot;
255      [&quot;latitude&quot;]=&gt;
256      float(51.6106)
257      [&quot;created&quot;]=&gt;
258      string(20) &quot;2021-04-20T22:25:33Z&quot;
259      [&quot;redirect_url&quot;]=&gt;
260      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
261      [&quot;category&quot;]=&gt;
262      array(3) {
263        [&quot;tag&quot;]=&gt;
264        string(7) &quot;it-jobs&quot;
265        [&quot;__CLASS__&quot;]=&gt;
266        string(31) &quot;Adzuna::API::Response::Category&quot;
267        [&quot;label&quot;]=&gt;
268        string(7) &quot;IT Jobs&quot;
269      }
270      [&quot;adref&quot;]=&gt;
271      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.LbCbnV_bIM1qvNR1Dy3QDrpk7GbrSimhQ9PBXKlYdHQ&quot;
272      [&quot;title&quot;]=&gt;
273      string(30) &quot;PHP Developer&quot;
274      [&quot;longitude&quot;]=&gt;
275      float(0.523168)
276      [&quot;description&quot;]=&gt;
277      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
278      [&quot;__CLASS__&quot;]=&gt;
279      string(26) &quot;Adzuna::API::Response::Job&quot;
280      [&quot;salary_max&quot;]=&gt;
281      int(35000)
282      [&quot;location&quot;]=&gt;
283      array(3) {
284        [&quot;display_name&quot;]=&gt;
285        string(15) &quot;Wickford, Essex&quot;
286        [&quot;__CLASS__&quot;]=&gt;
287        string(31) &quot;Adzuna::API::Response::Location&quot;
288        [&quot;area&quot;]=&gt;
289        array(4) {
290          [0]=&gt;
291          string(2) &quot;UK&quot;
292          [1]=&gt;
293          string(15) &quot;Eastern England&quot;
294          [2]=&gt;
295          string(5) &quot;Essex&quot;
296          [3]=&gt;
297          string(8) &quot;Wickford&quot;
298        }
299      }
300      [&quot;salary_min&quot;]=&gt;
301      int(30000)
302    }
303    [2]=&gt;
304    array(15) {
305      [&quot;title&quot;]=&gt;
306      string(30) &quot;PHP developer&quot;
307      [&quot;longitude&quot;]=&gt;
308      float(-2.29854)
309      [&quot;description&quot;]=&gt;
310      string(419) &quot;PHP developer - Manchester - £32,000 A PHP developer is required to join a well-established, innovative and award-winning business based in north Manchester as they expand ...  the development team. Having serviced businesses from small corner shops, to blue chip organisations across the UK, the successful PHP developer will have the opportunity to work on some ...&quot;
311      [&quot;__CLASS__&quot;]=&gt;
312      string(26) &quot;Adzuna::API::Response::Job&quot;
313      [&quot;salary_max&quot;]=&gt;
314      int(32000)
315      [&quot;location&quot;]=&gt;
316      array(3) {
317        [&quot;display_name&quot;]=&gt;
318        string(24) &quot;Bury, Greater Manchester&quot;
319        [&quot;__CLASS__&quot;]=&gt;
320        string(31) &quot;Adzuna::API::Response::Location&quot;
321        [&quot;area&quot;]=&gt;
322        array(4) {
323          [0]=&gt;
324          string(2) &quot;UK&quot;
325          [1]=&gt;
326          string(18) &quot;North West England&quot;
327          [2]=&gt;
328          string(18) &quot;Greater Manchester&quot;
329          [3]=&gt;
330          string(4) &quot;Bury&quot;
331        }
332      }
333      [&quot;salary_min&quot;]=&gt;
334      int(28000)
335      [&quot;salary_is_predicted&quot;]=&gt;
336      string(1) &quot;0&quot;
337      [&quot;company&quot;]=&gt;
338      array(2) {
339        [&quot;display_name&quot;]=&gt;
340        string(6) &quot;Capita&quot;
341        [&quot;__CLASS__&quot;]=&gt;
342        string(30) &quot;Adzuna::API::Response::Company&quot;
343      }
344      [&quot;id&quot;]=&gt;
345      string(10) &quot;2102200703&quot;
346      [&quot;latitude&quot;]=&gt;
347      float(53.593498)
348      [&quot;redirect_url&quot;]=&gt;
349      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2102200703?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=395C49C57A5FC0605CD718A9D5FDF04E985F3780&quot;
350      [&quot;created&quot;]=&gt;
351      string(20) &quot;2021-04-06T18:58:11Z&quot;
352      [&quot;category&quot;]=&gt;
353      array(3) {
354        [&quot;label&quot;]=&gt;
355        string(7) &quot;IT Jobs&quot;
356        [&quot;tag&quot;]=&gt;
357        string(7) &quot;it-jobs&quot;
358        [&quot;__CLASS__&quot;]=&gt;
359        string(31) &quot;Adzuna::API::Response::Category&quot;
360      }
361      [&quot;adref&quot;]=&gt;
362      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEwMjIwMDcwMyIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.OGD0UUmtvmcN-BDauzaIIpEzqg2TwPOWmIen6AldiG0&quot;
363    }
364    [3]=&gt;
365    array(13) {
366      [&quot;location&quot;]=&gt;
367      array(3) {
368        [&quot;__CLASS__&quot;]=&gt;
369        string(31) &quot;Adzuna::API::Response::Location&quot;
370        [&quot;display_name&quot;]=&gt;
371        string(2) &quot;UK&quot;
372        [&quot;area&quot;]=&gt;
373        array(1) {
374          [0]=&gt;
375          string(2) &quot;UK&quot;
376        }
377      }
378      [&quot;salary_min&quot;]=&gt;
379      int(0)
380      [&quot;description&quot;]=&gt;
381      string(408) &quot;Mid / Senior PHP Developer technologi are looking for a capable, knowledgeable, motivated individual to assist in developing the software that supports the service proposition ...  revolution to the UK card payments industry focusing on system innovation and service excellence. Salary: Up to £65,000 Job Type: Full Time Responsibilities of the Mid/Senior PHP Developer ...&quot;
382      [&quot;__CLASS__&quot;]=&gt;
383      string(26) &quot;Adzuna::API::Response::Job&quot;
384      [&quot;salary_max&quot;]=&gt;
385      int(65000)
386      [&quot;title&quot;]=&gt;
387      string(30) &quot;PHP Developer&quot;
388      [&quot;category&quot;]=&gt;
389      array(3) {
390        [&quot;label&quot;]=&gt;
391        string(7) &quot;IT Jobs&quot;
392        [&quot;__CLASS__&quot;]=&gt;
393        string(31) &quot;Adzuna::API::Response::Category&quot;
394        [&quot;tag&quot;]=&gt;
395        string(7) &quot;it-jobs&quot;
396      }
397      [&quot;adref&quot;]=&gt;
398      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMDkxNDMwNDMwIn0.zhUM-Aw2XdL-gVddZ6279px_pj3gs6ZWr_WKXpfkoX8&quot;
399      [&quot;redirect_url&quot;]=&gt;
400      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2091430430?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=2720D4577AE58EBCB28D1478075CC47866B3CF33&quot;
401      [&quot;created&quot;]=&gt;
402      string(20) &quot;2021-04-01T18:21:44Z&quot;
403      [&quot;id&quot;]=&gt;
404      string(10) &quot;2091430430&quot;
405      [&quot;company&quot;]=&gt;
406      array(2) {
407        [&quot;display_name&quot;]=&gt;
408        string(10) &quot;technologi&quot;
409        [&quot;__CLASS__&quot;]=&gt;
410        string(30) &quot;Adzuna::API::Response::Company&quot;
411      }
412      [&quot;salary_is_predicted&quot;]=&gt;
413      string(1) &quot;0&quot;
414    }
415$result=json_decode(curl_exec($ch),false); 
416
417foreach ($result-&gt;results as $job){ 
418echo $job-&gt;id; 
419} 
420

and when the json parameter is true i.e ..

then this :

1        &lt;?php
2
3$header[] = &quot;Content-Type:application/x-www-form-urlencoded&quot;;
4  $header[] = &quot;Accept:application/json&quot;;
5
6$ch=curl_init();
7curl_setopt($ch,CURLOPT_URL,&quot;http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=ID&amp;app_key=KEY&amp;results_per_page=20&amp;what=PHP&quot;);
8
9//do a POST
10curl_setopt($ch,CURLOPT_POST,false);
11//curl_setopt($ch,CURLOPT_POSTFIELDS,&quot;id=333&quot;);
12
13
14curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
15curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
16curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
17
18
19
20
21$result=json_decode(curl_exec($ch),true);
22
23//$result=curl_exec($ch);
24
25curl_close($ch);
26
27echo &quot;&lt;pre&gt;&quot;;
28
29
30//print_r($result);
31
32foreach ($result as $row){
33   echo  $row-&gt;title;
34}
35
36?&gt;
37title
38salary_max
39description
40redirect_url
41salary_min
42company
43 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
44    Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
45   Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
46 Trying to get property 'title' of non-object in /www/wwwroot/demo.aekpani.net/recruit/wp-content/themes/recruit/Umair/api.php
47 object(stdClass)#1 (4) {
48  [&quot;__CLASS__&quot;]=&gt;
49  string(39) &quot;Adzuna::API::Response::JobSearchResults&quot;
50  [&quot;results&quot;]=&gt;
51  array(20) {
52    [0]=&gt;
53    object(stdClass)#2 (15) {
54      [&quot;description&quot;]=&gt;
55      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
56      [&quot;company&quot;]=&gt;
57      object(stdClass)#3 (2) {
58        [&quot;display_name&quot;]=&gt;
59        string(7) &quot;Ardotec&quot;
60        [&quot;__CLASS__&quot;]=&gt;
61        string(30) &quot;Adzuna::API::Response::Company&quot;
62      }
63      [&quot;redirect_url&quot;]=&gt;
64      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
65      [&quot;created&quot;]=&gt;
66      string(20) &quot;2021-04-27T06:43:41Z&quot;
67      [&quot;__CLASS__&quot;]=&gt;
68      string(26) &quot;Adzuna::API::Response::Job&quot;
69      [&quot;salary_is_predicted&quot;]=&gt;
70      string(1) &quot;0&quot;
71      [&quot;longitude&quot;]=&gt;
72      float(-0.02806)
73      [&quot;salary_min&quot;]=&gt;
74      int(45000)
75      [&quot;category&quot;]=&gt;
76      object(stdClass)#4 (3) {
77        [&quot;__CLASS__&quot;]=&gt;
78        string(31) &quot;Adzuna::API::Response::Category&quot;
79        [&quot;tag&quot;]=&gt;
80        string(7) &quot;it-jobs&quot;
81        [&quot;label&quot;]=&gt;
82        string(7) &quot;IT Jobs&quot;
83      }
84      [&quot;latitude&quot;]=&gt;
85      float(51.451818)
86      [&quot;title&quot;]=&gt;
87      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
88      [&quot;id&quot;]=&gt;
89      string(10) &quot;2143941919&quot;
90      [&quot;location&quot;]=&gt;
91      object(stdClass)#5 (3) {
92        [&quot;__CLASS__&quot;]=&gt;
93        string(31) &quot;Adzuna::API::Response::Location&quot;
94        [&quot;area&quot;]=&gt;
95        array(3) {
96          [0]=&gt;
97          string(2) &quot;UK&quot;
98          [1]=&gt;
99          string(6) &quot;London&quot;
100          [2]=&gt;
101          string(17) &quot;South East London&quot;
102        }
103        [&quot;display_name&quot;]=&gt;
104        string(25) &quot;South East London, London&quot;
105      }
106      [&quot;salary_max&quot;]=&gt;
107      int(65000)
108      [&quot;adref&quot;]=&gt;
109      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoidnNDbnJmLW42eEdjQ21pbUpCU2JkZyIsImkiOiIyMTQzOTQxOTE5In0.YAVVLkLQi_SLQpFN89qyKiJZO-A03xvIJ4Nsfp7LOcg&quot;
110    }
111    [1]=&gt;
112    object(stdClass)#6 (15) {
113      [&quot;__CLASS__&quot;]=&gt;
114      string(26) &quot;Adzuna::API::Response::Job&quot;
115      [&quot;created&quot;]=&gt;
116      string(20) &quot;2021-04-20T22:25:33Z&quot;
117      [&quot;salary_is_predicted&quot;]=&gt;
118      string(1) &quot;0&quot;
119      [&quot;redirect_url&quot;]=&gt;
120      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=vsCnrf-n6xGcCmimJBSbdg&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
121      [&quot;salary_min&quot;]=&gt;
122      int(30000)
123      [&quot;longitude&quot;]=&gt;
124      float(0.523168)
125      [&quot;company&quot;]=&gt;
126      object(stdClass)#7 (2) {
127        [&quot;__CLASS__&quot;]=&gt;
128        string(30) &quot;Adzuna::API::Response::Company&quot;
129        [&quot;display_name&quot;]=&gt;
130        string(12) &quot;White Stores&quot;
131      }
132      [&quot;description&quot;]=&gt;
133      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
134      [&quot;location&quot;]=&gt;
135      object(stdClass)#8 (3) {
136        [&quot;area&quot;]=&gt;
137        array(4) {
138          [0]=&gt;
139          string(2) &quot;UK&quot;
140          [1]=&gt;
141          string(15) &quot;Eastern England&quot;
142          [2]=&gt;
143          string(5) &quot;Essex&quot;
144          [3]=&gt;
145          string(8) &quot;Wickford&quot;
146        }
147        [&quot;__CLASS__&quot;]=&gt;
148        string(31) &quot;Adzuna::API::Response::Location&quot;
149        [&quot;display_name&quot;]=&gt;
150        string(15) &quot;Wickford, Essex&quot;
151      }
152      [&quot;id&quot;]=&gt;
153      string(10) &quot;2129749481&quot;
154      [&quot;adref&quot;]=&gt;
155      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJ2c0NucmYtbjZ4R2NDbWltSkJTYmRnIn0.QIdaNUTbRquI_T0_C2rAgfr-jOYABSU-bkq8m-DrPSM&quot;
156      [&quot;salary_max&quot;]=&gt;
157      int(35000)
158      [&quot;category&quot;]=&gt;
159      object(stdClass)#9 (3) {
160        [&quot;__CLASS__&quot;]=&gt;
161        string(31) &quot;Adzuna::API::Response::Category&quot;
162        [&quot;tag&quot;]=&gt;
163        string(7) &quot;it-jobs&quot;
164        [&quot;label&quot;]=&gt;
165        string(7) &quot;IT Jobs&quot;
166      }
167      [&quot;latitude&quot;]=&gt;
168      float(51.6106)
169      [&quot;title&quot;]=&gt;
170      string(30) &quot;PHP Developer&quot;
171    }
172$result=json_decode(curl_exec($ch),true);
173
174//$result=curl_exec($ch);
175
176curl_close($ch);
177
178echo &quot;&lt;pre&gt;&quot;;
179
180
181var_dump($result);
182array(4) {   [&quot;mean&quot;]=&gt;   float(45274.4)   [&quot;count&quot;]=&gt;   int(6140)   [&quot;__CLASS__&quot;]=&gt;   string(39) &quot;Adzuna::API::Response::JobSearchResults&quot; [&quot;results&quot;]=&gt;   array(20) {
183    [0]=&gt;
184    array(15) {
185      [&quot;salary_min&quot;]=&gt;
186      int(45000)
187      [&quot;location&quot;]=&gt;
188      array(3) {
189        [&quot;area&quot;]=&gt;
190        array(3) {
191          [0]=&gt;
192          string(2) &quot;UK&quot;
193          [1]=&gt;
194          string(6) &quot;London&quot;
195          [2]=&gt;
196          string(17) &quot;South East London&quot;
197        }
198        [&quot;display_name&quot;]=&gt;
199        string(25) &quot;South East London, London&quot;
200        [&quot;__CLASS__&quot;]=&gt;
201        string(31) &quot;Adzuna::API::Response::Location&quot;
202      }
203      [&quot;salary_max&quot;]=&gt;
204      int(65000)
205      [&quot;description&quot;]=&gt;
206      string(436) &quot;PHP Developer - PHP / Javascript / MVC FULLY REMOTE WORKING OFFERED / Must be elgible to work in the UK on a permanent basis Key Skills: PHP, Laravel or Symfony or YII2 ... , JavaScript , MVC Desirable: Redux, Firebase, Docker , Angular An exciting opportunity is on offer for a PHP Developer to work for an innovative and growing Fintech business. This is a fully ...&quot;
207      [&quot;__CLASS__&quot;]=&gt;
208      string(26) &quot;Adzuna::API::Response::Job&quot;
209      [&quot;longitude&quot;]=&gt;
210      float(-0.02806)
211      [&quot;title&quot;]=&gt;
212      string(74) &quot;PHP Developer - REMOTE / PHP /Javascript&quot;
213      [&quot;adref&quot;]=&gt;
214      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMTQzOTQxOTE5In0.xdtRRI8U0hAlL3q9NvVfXP8yZ_EWoB7o3ZUbN4856u0&quot;
215      [&quot;category&quot;]=&gt;
216      array(3) {
217        [&quot;label&quot;]=&gt;
218        string(7) &quot;IT Jobs&quot;
219        [&quot;tag&quot;]=&gt;
220        string(7) &quot;it-jobs&quot;
221        [&quot;__CLASS__&quot;]=&gt;
222        string(31) &quot;Adzuna::API::Response::Category&quot;
223      }
224      [&quot;redirect_url&quot;]=&gt;
225      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2143941919?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=07CB17CA90C1D1FC9E83060222D3D3C904E39638&quot;
226      [&quot;created&quot;]=&gt;
227      string(20) &quot;2021-04-27T06:43:41Z&quot;
228      [&quot;latitude&quot;]=&gt;
229      float(51.451818)
230      [&quot;id&quot;]=&gt;
231      string(10) &quot;2143941919&quot;
232      [&quot;salary_is_predicted&quot;]=&gt;
233      string(1) &quot;0&quot;
234      [&quot;company&quot;]=&gt;
235      array(2) {
236        [&quot;display_name&quot;]=&gt;
237        string(7) &quot;Ardotec&quot;
238        [&quot;__CLASS__&quot;]=&gt;
239        string(30) &quot;Adzuna::API::Response::Company&quot;
240      }
241    }
242    [1]=&gt;
243    array(15) {
244      [&quot;salary_is_predicted&quot;]=&gt;
245      string(1) &quot;0&quot;
246      [&quot;company&quot;]=&gt;
247      array(2) {
248        [&quot;display_name&quot;]=&gt;
249        string(12) &quot;White Stores&quot;
250        [&quot;__CLASS__&quot;]=&gt;
251        string(30) &quot;Adzuna::API::Response::Company&quot;
252      }
253      [&quot;id&quot;]=&gt;
254      string(10) &quot;2129749481&quot;
255      [&quot;latitude&quot;]=&gt;
256      float(51.6106)
257      [&quot;created&quot;]=&gt;
258      string(20) &quot;2021-04-20T22:25:33Z&quot;
259      [&quot;redirect_url&quot;]=&gt;
260      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2129749481?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=F174AADA1D7F4CEC4AEA259B9DA762A7AE80BF97&quot;
261      [&quot;category&quot;]=&gt;
262      array(3) {
263        [&quot;tag&quot;]=&gt;
264        string(7) &quot;it-jobs&quot;
265        [&quot;__CLASS__&quot;]=&gt;
266        string(31) &quot;Adzuna::API::Response::Category&quot;
267        [&quot;label&quot;]=&gt;
268        string(7) &quot;IT Jobs&quot;
269      }
270      [&quot;adref&quot;]=&gt;
271      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEyOTc0OTQ4MSIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.LbCbnV_bIM1qvNR1Dy3QDrpk7GbrSimhQ9PBXKlYdHQ&quot;
272      [&quot;title&quot;]=&gt;
273      string(30) &quot;PHP Developer&quot;
274      [&quot;longitude&quot;]=&gt;
275      float(0.523168)
276      [&quot;description&quot;]=&gt;
277      string(406) &quot;PHP Developer Wickford, Essex £30,000 - £35,000 per annum (depending on experience) At White Stores we are passionate about outdoor living. For more than 15 years, we have ... . As we continue to grow and experience success after success, we are now seeking a PHP Developer to join us and play a vital role in the development of PHP web applications ...&quot;
278      [&quot;__CLASS__&quot;]=&gt;
279      string(26) &quot;Adzuna::API::Response::Job&quot;
280      [&quot;salary_max&quot;]=&gt;
281      int(35000)
282      [&quot;location&quot;]=&gt;
283      array(3) {
284        [&quot;display_name&quot;]=&gt;
285        string(15) &quot;Wickford, Essex&quot;
286        [&quot;__CLASS__&quot;]=&gt;
287        string(31) &quot;Adzuna::API::Response::Location&quot;
288        [&quot;area&quot;]=&gt;
289        array(4) {
290          [0]=&gt;
291          string(2) &quot;UK&quot;
292          [1]=&gt;
293          string(15) &quot;Eastern England&quot;
294          [2]=&gt;
295          string(5) &quot;Essex&quot;
296          [3]=&gt;
297          string(8) &quot;Wickford&quot;
298        }
299      }
300      [&quot;salary_min&quot;]=&gt;
301      int(30000)
302    }
303    [2]=&gt;
304    array(15) {
305      [&quot;title&quot;]=&gt;
306      string(30) &quot;PHP developer&quot;
307      [&quot;longitude&quot;]=&gt;
308      float(-2.29854)
309      [&quot;description&quot;]=&gt;
310      string(419) &quot;PHP developer - Manchester - £32,000 A PHP developer is required to join a well-established, innovative and award-winning business based in north Manchester as they expand ...  the development team. Having serviced businesses from small corner shops, to blue chip organisations across the UK, the successful PHP developer will have the opportunity to work on some ...&quot;
311      [&quot;__CLASS__&quot;]=&gt;
312      string(26) &quot;Adzuna::API::Response::Job&quot;
313      [&quot;salary_max&quot;]=&gt;
314      int(32000)
315      [&quot;location&quot;]=&gt;
316      array(3) {
317        [&quot;display_name&quot;]=&gt;
318        string(24) &quot;Bury, Greater Manchester&quot;
319        [&quot;__CLASS__&quot;]=&gt;
320        string(31) &quot;Adzuna::API::Response::Location&quot;
321        [&quot;area&quot;]=&gt;
322        array(4) {
323          [0]=&gt;
324          string(2) &quot;UK&quot;
325          [1]=&gt;
326          string(18) &quot;North West England&quot;
327          [2]=&gt;
328          string(18) &quot;Greater Manchester&quot;
329          [3]=&gt;
330          string(4) &quot;Bury&quot;
331        }
332      }
333      [&quot;salary_min&quot;]=&gt;
334      int(28000)
335      [&quot;salary_is_predicted&quot;]=&gt;
336      string(1) &quot;0&quot;
337      [&quot;company&quot;]=&gt;
338      array(2) {
339        [&quot;display_name&quot;]=&gt;
340        string(6) &quot;Capita&quot;
341        [&quot;__CLASS__&quot;]=&gt;
342        string(30) &quot;Adzuna::API::Response::Company&quot;
343      }
344      [&quot;id&quot;]=&gt;
345      string(10) &quot;2102200703&quot;
346      [&quot;latitude&quot;]=&gt;
347      float(53.593498)
348      [&quot;redirect_url&quot;]=&gt;
349      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2102200703?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=395C49C57A5FC0605CD718A9D5FDF04E985F3780&quot;
350      [&quot;created&quot;]=&gt;
351      string(20) &quot;2021-04-06T18:58:11Z&quot;
352      [&quot;category&quot;]=&gt;
353      array(3) {
354        [&quot;label&quot;]=&gt;
355        string(7) &quot;IT Jobs&quot;
356        [&quot;tag&quot;]=&gt;
357        string(7) &quot;it-jobs&quot;
358        [&quot;__CLASS__&quot;]=&gt;
359        string(31) &quot;Adzuna::API::Response::Category&quot;
360      }
361      [&quot;adref&quot;]=&gt;
362      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJpIjoiMjEwMjIwMDcwMyIsInMiOiJKS05YQkFhbzZ4R1dVN3RXM3QyVFZBIn0.OGD0UUmtvmcN-BDauzaIIpEzqg2TwPOWmIen6AldiG0&quot;
363    }
364    [3]=&gt;
365    array(13) {
366      [&quot;location&quot;]=&gt;
367      array(3) {
368        [&quot;__CLASS__&quot;]=&gt;
369        string(31) &quot;Adzuna::API::Response::Location&quot;
370        [&quot;display_name&quot;]=&gt;
371        string(2) &quot;UK&quot;
372        [&quot;area&quot;]=&gt;
373        array(1) {
374          [0]=&gt;
375          string(2) &quot;UK&quot;
376        }
377      }
378      [&quot;salary_min&quot;]=&gt;
379      int(0)
380      [&quot;description&quot;]=&gt;
381      string(408) &quot;Mid / Senior PHP Developer technologi are looking for a capable, knowledgeable, motivated individual to assist in developing the software that supports the service proposition ...  revolution to the UK card payments industry focusing on system innovation and service excellence. Salary: Up to £65,000 Job Type: Full Time Responsibilities of the Mid/Senior PHP Developer ...&quot;
382      [&quot;__CLASS__&quot;]=&gt;
383      string(26) &quot;Adzuna::API::Response::Job&quot;
384      [&quot;salary_max&quot;]=&gt;
385      int(65000)
386      [&quot;title&quot;]=&gt;
387      string(30) &quot;PHP Developer&quot;
388      [&quot;category&quot;]=&gt;
389      array(3) {
390        [&quot;label&quot;]=&gt;
391        string(7) &quot;IT Jobs&quot;
392        [&quot;__CLASS__&quot;]=&gt;
393        string(31) &quot;Adzuna::API::Response::Category&quot;
394        [&quot;tag&quot;]=&gt;
395        string(7) &quot;it-jobs&quot;
396      }
397      [&quot;adref&quot;]=&gt;
398      string(128) &quot;eyJhbGciOiJIUzI1NiJ9.eyJzIjoiSktOWEJBYW82eEdXVTd0VzN0MlRWQSIsImkiOiIyMDkxNDMwNDMwIn0.zhUM-Aw2XdL-gVddZ6279px_pj3gs6ZWr_WKXpfkoX8&quot;
399      [&quot;redirect_url&quot;]=&gt;
400      string(152) &quot;https://www.adzuna.co.uk/jobs/land/ad/2091430430?se=JKNXBAao6xGWU7tW3t2TVA&amp;utm_medium=api&amp;utm_source=f6e0907b&amp;v=2720D4577AE58EBCB28D1478075CC47866B3CF33&quot;
401      [&quot;created&quot;]=&gt;
402      string(20) &quot;2021-04-01T18:21:44Z&quot;
403      [&quot;id&quot;]=&gt;
404      string(10) &quot;2091430430&quot;
405      [&quot;company&quot;]=&gt;
406      array(2) {
407        [&quot;display_name&quot;]=&gt;
408        string(10) &quot;technologi&quot;
409        [&quot;__CLASS__&quot;]=&gt;
410        string(30) &quot;Adzuna::API::Response::Company&quot;
411      }
412      [&quot;salary_is_predicted&quot;]=&gt;
413      string(1) &quot;0&quot;
414    }
415$result=json_decode(curl_exec($ch),false); 
416
417foreach ($result-&gt;results as $job){ 
418echo $job-&gt;id; 
419} 
420$result=json_decode(curl_exec($ch),true);  
421
422foreach ($result['results'] as $job){ 
423
424echo $job['id']; 
425
426} 
427

Source https://stackoverflow.com/questions/67298340

QUESTION

Using float left and right/ width 50% is not allowing my content to be responsive on mobile view

Asked 2021-Mar-10 at 10:41

I'm using "tiles" to show content, clicking on a tile expands content. Within the expanding content, I'm using the left hand side for displaying text (spec-info) and for the right hand side I'm using (icon-percent) to display an icon. I'm happy with this outcome as the icon sitting at the right hand side is positioned well in comparison to the text. However when on smaller device sizes, (ipad, iphone) - the "split" view of using left and right would be reverted to full width with the icon scaling appropriately and displaying above the text. I'm familiar with media queries but not sure they're appropriate for this implementation? any ideas would be really appreciated! I've created a working fiddle here too: https://jsfiddle.net/6gsvjt4r/1/

1function openTab(tabName, event) {
2  event.target.classList.add("active-tile");
3  event.target.children[2].classList.add("arrow-up");
4  var i, x;
5  x = document.getElementsByClassName("content");
6  for (i = 0; i &lt; x.length; i++) {
7    x[i].style.display = "none";
8  }
9  document.getElementById(tabName).style.display = "block";
10
11  // Get all the tabs into a collection
12  // (don't use .getElementsByClassName()!)
13  let tabs = document.querySelectorAll(".tile");
14
15  // Set up a click event handler on each of the tabs
16  tabs.forEach(function (tab) {
17    tab.addEventListener("click", function (event) {
18      // Loop over all the tabs and remove the active class
19      tabs.forEach(function (tab) {
20        tab.classList.remove("active-tile");
21        tab.children[2].classList.remove("arrow-up");
22      });
23
24      // Set the background of the clicked tab
25      this.classList.add("active-tile");
26      tab.children[2].classList.add("arrow-up");
27    });
28  });
29}
30function closeTab(tabName, event) {
31  x = document.getElementsByClassName("content");
32  for (i = 0; i &lt; x.length; i++) {
33    x[i].style.display = "none";
34  }
35  let tabs = document.querySelectorAll(".tile");
36  tabs.forEach(function (tab) {
37    tab.classList.remove("active-tile");
38    tab.children[2].classList.remove("arrow-up");
39  });
40}
1function openTab(tabName, event) {
2  event.target.classList.add("active-tile");
3  event.target.children[2].classList.add("arrow-up");
4  var i, x;
5  x = document.getElementsByClassName("content");
6  for (i = 0; i &lt; x.length; i++) {
7    x[i].style.display = "none";
8  }
9  document.getElementById(tabName).style.display = "block";
10
11  // Get all the tabs into a collection
12  // (don't use .getElementsByClassName()!)
13  let tabs = document.querySelectorAll(".tile");
14
15  // Set up a click event handler on each of the tabs
16  tabs.forEach(function (tab) {
17    tab.addEventListener("click", function (event) {
18      // Loop over all the tabs and remove the active class
19      tabs.forEach(function (tab) {
20        tab.classList.remove("active-tile");
21        tab.children[2].classList.remove("arrow-up");
22      });
23
24      // Set the background of the clicked tab
25      this.classList.add("active-tile");
26      tab.children[2].classList.add("arrow-up");
27    });
28  });
29}
30function closeTab(tabName, event) {
31  x = document.getElementsByClassName("content");
32  for (i = 0; i &lt; x.length; i++) {
33    x[i].style.display = "none";
34  }
35  let tabs = document.querySelectorAll(".tile");
36  tabs.forEach(function (tab) {
37    tab.classList.remove("active-tile");
38    tab.children[2].classList.remove("arrow-up");
39  });
40}body {
41  margin: 0;
42  font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46  padding-top: 70px;
47}
48
49.section-content-specialisms {
50  max-width: $page-width;
51  margin: 0 auto;
52  padding: 0 $p-base;
53  margin-bottom: 70px;
54
55  justify-content: space-between;
56  position: relative;
57}
58
59@media (min-width: $tablets) {
60  .section-content-specialisms {
61    flex-direction: row;
62    padding-left: 2rem;
63    padding-right: 2rem;
64  }
65}
66
67.box {
68  display: flex;
69  flex-wrap: wrap;
70  flex-direction: row;
71  padding-right: 6rem;
72  padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78  box-sizing: border-box;
79}
80
81.tile &gt; * {
82  pointer-events: none;
83}
84
85.tile {
86  flex: 1 0 auto;
87  order: 0;
88  flex-basis: 25%;
89  border: 1px solid grey;
90
91  /* For visual only  */
92  background-color: #222;
93  height: 150px;
94  text-align: center;
95  font-size: 16px;
96  color: white;
97  cursor: pointer;
98}
99
100.active-tile {
101  flex: 1 0 auto;
102  order: 0;
103  flex-basis: 25%;
104
105  /* For visual only  */
106  text-align: center;
107  border: 1px solid #000;
108  background-color: green;
109  cursor: pointer;
110}
111
112.content {
113  order: 1;
114  flex: 1 0 100%;
115
116  /* For visual only  */
117  padding: 20px;
118  color: black;
119  text-align: center;
120  border: 1px solid #000;
121  background-color: #228b22;
122}
123
124.description {
125  text-align: left;
126}
127
128.spec-info {
129  text-align: left;
130  width: 50%;
131  float: left;
132}
133
134.percent-icon-size {
135  width: 295px;
136  height: 260px;
137}
138
139.icon-percent {
140  width: 50%;
141  float: right;
142}
143
144.icon-spacing {
145  margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150  content: "";
151  display: table;
152  clear: both;
153}
154
155.closebtn {
156  float: right;
157  color: black;
158  cursor: pointer;
159}
160
161.arrow-down {
162  width: 25px;
163  height: 25px;
164}
165
166.arrow-up {
167  width: 25px;
168  height: 25px;
169  -webkit-transform: rotate(180deg);
170  -moz-transform: rotate(180deg);
171  -ms-transform: rotate(180deg);
172  -o-transform: rotate(180deg);
173  transform: rotate(180deg);
174}
175
176.specialisms-content {
177  padding-top: 25px;
178  padding-bottom: 25px;
179}
180
181.percentage {
182  color: #228b22;
183}
184
185/* 
186  "Desktop" and above
187 */
188@media (max-width: 480px) {
189  .box {
190    flex-direction: column;
191    padding-right: 1rem;
192    padding-left: 1rem;
193  }
194
195  .content {
196    order: 0;
197  }
198}
199
200@media (max-width: 768px) {
201  .box {
202    padding-right: 1rem;
203    padding-left: 1rem;
204  }
205}
1function openTab(tabName, event) {
2  event.target.classList.add("active-tile");
3  event.target.children[2].classList.add("arrow-up");
4  var i, x;
5  x = document.getElementsByClassName("content");
6  for (i = 0; i &lt; x.length; i++) {
7    x[i].style.display = "none";
8  }
9  document.getElementById(tabName).style.display = "block";
10
11  // Get all the tabs into a collection
12  // (don't use .getElementsByClassName()!)
13  let tabs = document.querySelectorAll(".tile");
14
15  // Set up a click event handler on each of the tabs
16  tabs.forEach(function (tab) {
17    tab.addEventListener("click", function (event) {
18      // Loop over all the tabs and remove the active class
19      tabs.forEach(function (tab) {
20        tab.classList.remove("active-tile");
21        tab.children[2].classList.remove("arrow-up");
22      });
23
24      // Set the background of the clicked tab
25      this.classList.add("active-tile");
26      tab.children[2].classList.add("arrow-up");
27    });
28  });
29}
30function closeTab(tabName, event) {
31  x = document.getElementsByClassName("content");
32  for (i = 0; i &lt; x.length; i++) {
33    x[i].style.display = "none";
34  }
35  let tabs = document.querySelectorAll(".tile");
36  tabs.forEach(function (tab) {
37    tab.classList.remove("active-tile");
38    tab.children[2].classList.remove("arrow-up");
39  });
40}body {
41  margin: 0;
42  font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46  padding-top: 70px;
47}
48
49.section-content-specialisms {
50  max-width: $page-width;
51  margin: 0 auto;
52  padding: 0 $p-base;
53  margin-bottom: 70px;
54
55  justify-content: space-between;
56  position: relative;
57}
58
59@media (min-width: $tablets) {
60  .section-content-specialisms {
61    flex-direction: row;
62    padding-left: 2rem;
63    padding-right: 2rem;
64  }
65}
66
67.box {
68  display: flex;
69  flex-wrap: wrap;
70  flex-direction: row;
71  padding-right: 6rem;
72  padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78  box-sizing: border-box;
79}
80
81.tile &gt; * {
82  pointer-events: none;
83}
84
85.tile {
86  flex: 1 0 auto;
87  order: 0;
88  flex-basis: 25%;
89  border: 1px solid grey;
90
91  /* For visual only  */
92  background-color: #222;
93  height: 150px;
94  text-align: center;
95  font-size: 16px;
96  color: white;
97  cursor: pointer;
98}
99
100.active-tile {
101  flex: 1 0 auto;
102  order: 0;
103  flex-basis: 25%;
104
105  /* For visual only  */
106  text-align: center;
107  border: 1px solid #000;
108  background-color: green;
109  cursor: pointer;
110}
111
112.content {
113  order: 1;
114  flex: 1 0 100%;
115
116  /* For visual only  */
117  padding: 20px;
118  color: black;
119  text-align: center;
120  border: 1px solid #000;
121  background-color: #228b22;
122}
123
124.description {
125  text-align: left;
126}
127
128.spec-info {
129  text-align: left;
130  width: 50%;
131  float: left;
132}
133
134.percent-icon-size {
135  width: 295px;
136  height: 260px;
137}
138
139.icon-percent {
140  width: 50%;
141  float: right;
142}
143
144.icon-spacing {
145  margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150  content: "";
151  display: table;
152  clear: both;
153}
154
155.closebtn {
156  float: right;
157  color: black;
158  cursor: pointer;
159}
160
161.arrow-down {
162  width: 25px;
163  height: 25px;
164}
165
166.arrow-up {
167  width: 25px;
168  height: 25px;
169  -webkit-transform: rotate(180deg);
170  -moz-transform: rotate(180deg);
171  -ms-transform: rotate(180deg);
172  -o-transform: rotate(180deg);
173  transform: rotate(180deg);
174}
175
176.specialisms-content {
177  padding-top: 25px;
178  padding-bottom: 25px;
179}
180
181.percentage {
182  color: #228b22;
183}
184
185/* 
186  "Desktop" and above
187 */
188@media (max-width: 480px) {
189  .box {
190    flex-direction: column;
191    padding-right: 1rem;
192    padding-left: 1rem;
193  }
194
195  .content {
196    order: 0;
197  }
198}
199
200@media (max-width: 768px) {
201  .box {
202    padding-right: 1rem;
203    padding-left: 1rem;
204  }
205}&lt;div class="box"&gt;
206   &lt;div class="tile" onclick="openTab('b1', event);"&gt;
207        &lt;img class="icon-spacing" src="./assets/Icons/Banking.svg" /&gt;
208        &lt;p&gt;Banking&lt;/p&gt;
209        &lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
210      &lt;/div&gt;
211      &lt;div
212        id="b1"
213        class="content"
214        style="display: none; background: white"
215      &gt;
216        &lt;span onclick="closeTab('b1', event)" class="closebtn"
217          &gt;&amp;times;&lt;/span
218        &gt;
219        &lt;div class="expanded-content"&gt;&lt;/div&gt;
220
221        &lt;div class="spec-info"&gt;
222          &lt;h3&gt;Banking&lt;/h3&gt;
223          &lt;p&gt;
224            Core banking products including personal current accounts,
225            savings and mortgages. This category also includes banking
226            platforms and operations FinTechs such as Railsbank and
227            challenger banks such as Atom.
228          &lt;/p&gt;
229          &lt;ul&gt;
230            &lt;li&gt;Banking Personal Current Accounts (PCA)&lt;/li&gt;
231            &lt;li&gt;Banking Platforms&lt;/li&gt;
232            &lt;li&gt;Banking Operations&lt;/li&gt;
233          &lt;/ul&gt;
234        &lt;/div&gt;
235        &lt;div class="icon-percent"&gt;
236          &lt;img src="./assets/37.png" alt="" class="percent-icon-size" /&gt;
237        &lt;/div&gt;
238      &lt;/div&gt;
239&lt;div class="tile" onclick="openTab('b2', event);"&gt;
240&lt;img class="icon-spacing" src="./assets/Icons/Regtech.svg" /&gt;
241&lt;p&gt;RegTech&lt;/p&gt;
242&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
243&lt;/div&gt;
244&lt;div id="b2" class="content" style="display: none; background: white"&gt;
245&lt;span onclick="closeTab('b2', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
246&lt;div class="description"&gt;
247&lt;h3&gt;RegTech - &lt;span class="percentage"&gt;10%&lt;/span&gt;&lt;/h3&gt;
248&lt;p&gt;
249  This FinTech category focuses on companies with activities and
250  technology focused on reimagining and streamlining risk (AML, KYC),
251  credit scoring and compliance software.
252&lt;/p&gt;
253&lt;/div&gt;
254&lt;/div&gt;
255&lt;div class="tile" onclick="openTab('b3', event);"&gt;
256&lt;img class="icon-spacing" src="./assets/Icons/InsurTech.svg" /&gt;
257&lt;p&gt;InsurTech&lt;/p&gt;
258&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
259&lt;/div&gt;
260&lt;div id="b3" class="content" style="display: none; background: white"&gt;
261&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
262&lt;div class="description"&gt;
263&lt;h3&gt;InsurTech - &lt;span class="percentage"&gt;6%&lt;/span&gt;&lt;/h3&gt;
264&lt;p&gt;
265  InsurTech includes companies selling insurance digitally or introducing
266  new business models or (re)insurance specific software.
267&lt;/p&gt;
268&lt;ul&gt;
269  &lt;li&gt;InsurTech - Commercial&lt;/li&gt;
270  &lt;li&gt;InsurTech - Personal&lt;/li&gt;
271  &lt;li&gt;Insurance Platforms and Operations&lt;/li&gt;
272&lt;/ul&gt;
273&lt;/div&gt;
274&lt;/div&gt;
275&lt;div class="tile" onclick="openTab('b4', event);"&gt;
276&lt;img class="icon-spacing" src="./assets/Icons/Lending.svg" /&gt;
277&lt;p&gt;Lending&lt;/p&gt;
278&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
279&lt;/div&gt;
280&lt;div id="b4" class="content" style="display: none; background: white"&gt;
281&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
282&lt;div class="description"&gt;
283&lt;h3&gt;Lending - &lt;span class="percentage"&gt;13%&lt;/span&gt;&lt;/h3&gt;
284&lt;p&gt;
285  Companies focused on innnovating credit, from commerical to alternative
286  and specialist lenders or platforms facilitating P2P.
287&lt;/p&gt;
288&lt;ul&gt;
289  &lt;li&gt;Consumer Lending&lt;/li&gt;
290  &lt;li&gt;Commercial Lending&lt;/li&gt;
291  &lt;li&gt;P2P Lending&lt;/li&gt;
292&lt;/ul&gt;
293&lt;/div&gt;
294&lt;/div&gt;
295&lt;/div&gt;

ANSWER

Answered 2021-Mar-09 at 18:36

There are a couple of things I'd suggest doing:

Remove fixed sizing on the .percent-icon-size image

I see in your CSS, you have the height and width set on

1function openTab(tabName, event) {
2  event.target.classList.add("active-tile");
3  event.target.children[2].classList.add("arrow-up");
4  var i, x;
5  x = document.getElementsByClassName("content");
6  for (i = 0; i &lt; x.length; i++) {
7    x[i].style.display = "none";
8  }
9  document.getElementById(tabName).style.display = "block";
10
11  // Get all the tabs into a collection
12  // (don't use .getElementsByClassName()!)
13  let tabs = document.querySelectorAll(".tile");
14
15  // Set up a click event handler on each of the tabs
16  tabs.forEach(function (tab) {
17    tab.addEventListener("click", function (event) {
18      // Loop over all the tabs and remove the active class
19      tabs.forEach(function (tab) {
20        tab.classList.remove("active-tile");
21        tab.children[2].classList.remove("arrow-up");
22      });
23
24      // Set the background of the clicked tab
25      this.classList.add("active-tile");
26      tab.children[2].classList.add("arrow-up");
27    });
28  });
29}
30function closeTab(tabName, event) {
31  x = document.getElementsByClassName("content");
32  for (i = 0; i &lt; x.length; i++) {
33    x[i].style.display = "none";
34  }
35  let tabs = document.querySelectorAll(".tile");
36  tabs.forEach(function (tab) {
37    tab.classList.remove("active-tile");
38    tab.children[2].classList.remove("arrow-up");
39  });
40}body {
41  margin: 0;
42  font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46  padding-top: 70px;
47}
48
49.section-content-specialisms {
50  max-width: $page-width;
51  margin: 0 auto;
52  padding: 0 $p-base;
53  margin-bottom: 70px;
54
55  justify-content: space-between;
56  position: relative;
57}
58
59@media (min-width: $tablets) {
60  .section-content-specialisms {
61    flex-direction: row;
62    padding-left: 2rem;
63    padding-right: 2rem;
64  }
65}
66
67.box {
68  display: flex;
69  flex-wrap: wrap;
70  flex-direction: row;
71  padding-right: 6rem;
72  padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78  box-sizing: border-box;
79}
80
81.tile &gt; * {
82  pointer-events: none;
83}
84
85.tile {
86  flex: 1 0 auto;
87  order: 0;
88  flex-basis: 25%;
89  border: 1px solid grey;
90
91  /* For visual only  */
92  background-color: #222;
93  height: 150px;
94  text-align: center;
95  font-size: 16px;
96  color: white;
97  cursor: pointer;
98}
99
100.active-tile {
101  flex: 1 0 auto;
102  order: 0;
103  flex-basis: 25%;
104
105  /* For visual only  */
106  text-align: center;
107  border: 1px solid #000;
108  background-color: green;
109  cursor: pointer;
110}
111
112.content {
113  order: 1;
114  flex: 1 0 100%;
115
116  /* For visual only  */
117  padding: 20px;
118  color: black;
119  text-align: center;
120  border: 1px solid #000;
121  background-color: #228b22;
122}
123
124.description {
125  text-align: left;
126}
127
128.spec-info {
129  text-align: left;
130  width: 50%;
131  float: left;
132}
133
134.percent-icon-size {
135  width: 295px;
136  height: 260px;
137}
138
139.icon-percent {
140  width: 50%;
141  float: right;
142}
143
144.icon-spacing {
145  margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150  content: "";
151  display: table;
152  clear: both;
153}
154
155.closebtn {
156  float: right;
157  color: black;
158  cursor: pointer;
159}
160
161.arrow-down {
162  width: 25px;
163  height: 25px;
164}
165
166.arrow-up {
167  width: 25px;
168  height: 25px;
169  -webkit-transform: rotate(180deg);
170  -moz-transform: rotate(180deg);
171  -ms-transform: rotate(180deg);
172  -o-transform: rotate(180deg);
173  transform: rotate(180deg);
174}
175
176.specialisms-content {
177  padding-top: 25px;
178  padding-bottom: 25px;
179}
180
181.percentage {
182  color: #228b22;
183}
184
185/* 
186  "Desktop" and above
187 */
188@media (max-width: 480px) {
189  .box {
190    flex-direction: column;
191    padding-right: 1rem;
192    padding-left: 1rem;
193  }
194
195  .content {
196    order: 0;
197  }
198}
199
200@media (max-width: 768px) {
201  .box {
202    padding-right: 1rem;
203    padding-left: 1rem;
204  }
205}&lt;div class="box"&gt;
206   &lt;div class="tile" onclick="openTab('b1', event);"&gt;
207        &lt;img class="icon-spacing" src="./assets/Icons/Banking.svg" /&gt;
208        &lt;p&gt;Banking&lt;/p&gt;
209        &lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
210      &lt;/div&gt;
211      &lt;div
212        id="b1"
213        class="content"
214        style="display: none; background: white"
215      &gt;
216        &lt;span onclick="closeTab('b1', event)" class="closebtn"
217          &gt;&amp;times;&lt;/span
218        &gt;
219        &lt;div class="expanded-content"&gt;&lt;/div&gt;
220
221        &lt;div class="spec-info"&gt;
222          &lt;h3&gt;Banking&lt;/h3&gt;
223          &lt;p&gt;
224            Core banking products including personal current accounts,
225            savings and mortgages. This category also includes banking
226            platforms and operations FinTechs such as Railsbank and
227            challenger banks such as Atom.
228          &lt;/p&gt;
229          &lt;ul&gt;
230            &lt;li&gt;Banking Personal Current Accounts (PCA)&lt;/li&gt;
231            &lt;li&gt;Banking Platforms&lt;/li&gt;
232            &lt;li&gt;Banking Operations&lt;/li&gt;
233          &lt;/ul&gt;
234        &lt;/div&gt;
235        &lt;div class="icon-percent"&gt;
236          &lt;img src="./assets/37.png" alt="" class="percent-icon-size" /&gt;
237        &lt;/div&gt;
238      &lt;/div&gt;
239&lt;div class="tile" onclick="openTab('b2', event);"&gt;
240&lt;img class="icon-spacing" src="./assets/Icons/Regtech.svg" /&gt;
241&lt;p&gt;RegTech&lt;/p&gt;
242&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
243&lt;/div&gt;
244&lt;div id="b2" class="content" style="display: none; background: white"&gt;
245&lt;span onclick="closeTab('b2', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
246&lt;div class="description"&gt;
247&lt;h3&gt;RegTech - &lt;span class="percentage"&gt;10%&lt;/span&gt;&lt;/h3&gt;
248&lt;p&gt;
249  This FinTech category focuses on companies with activities and
250  technology focused on reimagining and streamlining risk (AML, KYC),
251  credit scoring and compliance software.
252&lt;/p&gt;
253&lt;/div&gt;
254&lt;/div&gt;
255&lt;div class="tile" onclick="openTab('b3', event);"&gt;
256&lt;img class="icon-spacing" src="./assets/Icons/InsurTech.svg" /&gt;
257&lt;p&gt;InsurTech&lt;/p&gt;
258&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
259&lt;/div&gt;
260&lt;div id="b3" class="content" style="display: none; background: white"&gt;
261&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
262&lt;div class="description"&gt;
263&lt;h3&gt;InsurTech - &lt;span class="percentage"&gt;6%&lt;/span&gt;&lt;/h3&gt;
264&lt;p&gt;
265  InsurTech includes companies selling insurance digitally or introducing
266  new business models or (re)insurance specific software.
267&lt;/p&gt;
268&lt;ul&gt;
269  &lt;li&gt;InsurTech - Commercial&lt;/li&gt;
270  &lt;li&gt;InsurTech - Personal&lt;/li&gt;
271  &lt;li&gt;Insurance Platforms and Operations&lt;/li&gt;
272&lt;/ul&gt;
273&lt;/div&gt;
274&lt;/div&gt;
275&lt;div class="tile" onclick="openTab('b4', event);"&gt;
276&lt;img class="icon-spacing" src="./assets/Icons/Lending.svg" /&gt;
277&lt;p&gt;Lending&lt;/p&gt;
278&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
279&lt;/div&gt;
280&lt;div id="b4" class="content" style="display: none; background: white"&gt;
281&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
282&lt;div class="description"&gt;
283&lt;h3&gt;Lending - &lt;span class="percentage"&gt;13%&lt;/span&gt;&lt;/h3&gt;
284&lt;p&gt;
285  Companies focused on innnovating credit, from commerical to alternative
286  and specialist lenders or platforms facilitating P2P.
287&lt;/p&gt;
288&lt;ul&gt;
289  &lt;li&gt;Consumer Lending&lt;/li&gt;
290  &lt;li&gt;Commercial Lending&lt;/li&gt;
291  &lt;li&gt;P2P Lending&lt;/li&gt;
292&lt;/ul&gt;
293&lt;/div&gt;
294&lt;/div&gt;
295&lt;/div&gt;.percent-icon-size {
296    width: 295px;
297    height: 260px;
298}
299

This is keeping this image at the same size no matter how large or small the panel containing the content is. The following snippet would make the image be as large as it can be but be limited to the width of it's container:

1function openTab(tabName, event) {
2  event.target.classList.add("active-tile");
3  event.target.children[2].classList.add("arrow-up");
4  var i, x;
5  x = document.getElementsByClassName("content");
6  for (i = 0; i &lt; x.length; i++) {
7    x[i].style.display = "none";
8  }
9  document.getElementById(tabName).style.display = "block";
10
11  // Get all the tabs into a collection
12  // (don't use .getElementsByClassName()!)
13  let tabs = document.querySelectorAll(".tile");
14
15  // Set up a click event handler on each of the tabs
16  tabs.forEach(function (tab) {
17    tab.addEventListener("click", function (event) {
18      // Loop over all the tabs and remove the active class
19      tabs.forEach(function (tab) {
20        tab.classList.remove("active-tile");
21        tab.children[2].classList.remove("arrow-up");
22      });
23
24      // Set the background of the clicked tab
25      this.classList.add("active-tile");
26      tab.children[2].classList.add("arrow-up");
27    });
28  });
29}
30function closeTab(tabName, event) {
31  x = document.getElementsByClassName("content");
32  for (i = 0; i &lt; x.length; i++) {
33    x[i].style.display = "none";
34  }
35  let tabs = document.querySelectorAll(".tile");
36  tabs.forEach(function (tab) {
37    tab.classList.remove("active-tile");
38    tab.children[2].classList.remove("arrow-up");
39  });
40}body {
41  margin: 0;
42  font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46  padding-top: 70px;
47}
48
49.section-content-specialisms {
50  max-width: $page-width;
51  margin: 0 auto;
52  padding: 0 $p-base;
53  margin-bottom: 70px;
54
55  justify-content: space-between;
56  position: relative;
57}
58
59@media (min-width: $tablets) {
60  .section-content-specialisms {
61    flex-direction: row;
62    padding-left: 2rem;
63    padding-right: 2rem;
64  }
65}
66
67.box {
68  display: flex;
69  flex-wrap: wrap;
70  flex-direction: row;
71  padding-right: 6rem;
72  padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78  box-sizing: border-box;
79}
80
81.tile &gt; * {
82  pointer-events: none;
83}
84
85.tile {
86  flex: 1 0 auto;
87  order: 0;
88  flex-basis: 25%;
89  border: 1px solid grey;
90
91  /* For visual only  */
92  background-color: #222;
93  height: 150px;
94  text-align: center;
95  font-size: 16px;
96  color: white;
97  cursor: pointer;
98}
99
100.active-tile {
101  flex: 1 0 auto;
102  order: 0;
103  flex-basis: 25%;
104
105  /* For visual only  */
106  text-align: center;
107  border: 1px solid #000;
108  background-color: green;
109  cursor: pointer;
110}
111
112.content {
113  order: 1;
114  flex: 1 0 100%;
115
116  /* For visual only  */
117  padding: 20px;
118  color: black;
119  text-align: center;
120  border: 1px solid #000;
121  background-color: #228b22;
122}
123
124.description {
125  text-align: left;
126}
127
128.spec-info {
129  text-align: left;
130  width: 50%;
131  float: left;
132}
133
134.percent-icon-size {
135  width: 295px;
136  height: 260px;
137}
138
139.icon-percent {
140  width: 50%;
141  float: right;
142}
143
144.icon-spacing {
145  margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150  content: "";
151  display: table;
152  clear: both;
153}
154
155.closebtn {
156  float: right;
157  color: black;
158  cursor: pointer;
159}
160
161.arrow-down {
162  width: 25px;
163  height: 25px;
164}
165
166.arrow-up {
167  width: 25px;
168  height: 25px;
169  -webkit-transform: rotate(180deg);
170  -moz-transform: rotate(180deg);
171  -ms-transform: rotate(180deg);
172  -o-transform: rotate(180deg);
173  transform: rotate(180deg);
174}
175
176.specialisms-content {
177  padding-top: 25px;
178  padding-bottom: 25px;
179}
180
181.percentage {
182  color: #228b22;
183}
184
185/* 
186  "Desktop" and above
187 */
188@media (max-width: 480px) {
189  .box {
190    flex-direction: column;
191    padding-right: 1rem;
192    padding-left: 1rem;
193  }
194
195  .content {
196    order: 0;
197  }
198}
199
200@media (max-width: 768px) {
201  .box {
202    padding-right: 1rem;
203    padding-left: 1rem;
204  }
205}&lt;div class="box"&gt;
206   &lt;div class="tile" onclick="openTab('b1', event);"&gt;
207        &lt;img class="icon-spacing" src="./assets/Icons/Banking.svg" /&gt;
208        &lt;p&gt;Banking&lt;/p&gt;
209        &lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
210      &lt;/div&gt;
211      &lt;div
212        id="b1"
213        class="content"
214        style="display: none; background: white"
215      &gt;
216        &lt;span onclick="closeTab('b1', event)" class="closebtn"
217          &gt;&amp;times;&lt;/span
218        &gt;
219        &lt;div class="expanded-content"&gt;&lt;/div&gt;
220
221        &lt;div class="spec-info"&gt;
222          &lt;h3&gt;Banking&lt;/h3&gt;
223          &lt;p&gt;
224            Core banking products including personal current accounts,
225            savings and mortgages. This category also includes banking
226            platforms and operations FinTechs such as Railsbank and
227            challenger banks such as Atom.
228          &lt;/p&gt;
229          &lt;ul&gt;
230            &lt;li&gt;Banking Personal Current Accounts (PCA)&lt;/li&gt;
231            &lt;li&gt;Banking Platforms&lt;/li&gt;
232            &lt;li&gt;Banking Operations&lt;/li&gt;
233          &lt;/ul&gt;
234        &lt;/div&gt;
235        &lt;div class="icon-percent"&gt;
236          &lt;img src="./assets/37.png" alt="" class="percent-icon-size" /&gt;
237        &lt;/div&gt;
238      &lt;/div&gt;
239&lt;div class="tile" onclick="openTab('b2', event);"&gt;
240&lt;img class="icon-spacing" src="./assets/Icons/Regtech.svg" /&gt;
241&lt;p&gt;RegTech&lt;/p&gt;
242&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
243&lt;/div&gt;
244&lt;div id="b2" class="content" style="display: none; background: white"&gt;
245&lt;span onclick="closeTab('b2', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
246&lt;div class="description"&gt;
247&lt;h3&gt;RegTech - &lt;span class="percentage"&gt;10%&lt;/span&gt;&lt;/h3&gt;
248&lt;p&gt;
249  This FinTech category focuses on companies with activities and
250  technology focused on reimagining and streamlining risk (AML, KYC),
251  credit scoring and compliance software.
252&lt;/p&gt;
253&lt;/div&gt;
254&lt;/div&gt;
255&lt;div class="tile" onclick="openTab('b3', event);"&gt;
256&lt;img class="icon-spacing" src="./assets/Icons/InsurTech.svg" /&gt;
257&lt;p&gt;InsurTech&lt;/p&gt;
258&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
259&lt;/div&gt;
260&lt;div id="b3" class="content" style="display: none; background: white"&gt;
261&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
262&lt;div class="description"&gt;
263&lt;h3&gt;InsurTech - &lt;span class="percentage"&gt;6%&lt;/span&gt;&lt;/h3&gt;
264&lt;p&gt;
265  InsurTech includes companies selling insurance digitally or introducing
266  new business models or (re)insurance specific software.
267&lt;/p&gt;
268&lt;ul&gt;
269  &lt;li&gt;InsurTech - Commercial&lt;/li&gt;
270  &lt;li&gt;InsurTech - Personal&lt;/li&gt;
271  &lt;li&gt;Insurance Platforms and Operations&lt;/li&gt;
272&lt;/ul&gt;
273&lt;/div&gt;
274&lt;/div&gt;
275&lt;div class="tile" onclick="openTab('b4', event);"&gt;
276&lt;img class="icon-spacing" src="./assets/Icons/Lending.svg" /&gt;
277&lt;p&gt;Lending&lt;/p&gt;
278&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
279&lt;/div&gt;
280&lt;div id="b4" class="content" style="display: none; background: white"&gt;
281&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
282&lt;div class="description"&gt;
283&lt;h3&gt;Lending - &lt;span class="percentage"&gt;13%&lt;/span&gt;&lt;/h3&gt;
284&lt;p&gt;
285  Companies focused on innnovating credit, from commerical to alternative
286  and specialist lenders or platforms facilitating P2P.
287&lt;/p&gt;
288&lt;ul&gt;
289  &lt;li&gt;Consumer Lending&lt;/li&gt;
290  &lt;li&gt;Commercial Lending&lt;/li&gt;
291  &lt;li&gt;P2P Lending&lt;/li&gt;
292&lt;/ul&gt;
293&lt;/div&gt;
294&lt;/div&gt;
295&lt;/div&gt;.percent-icon-size {
296    width: 295px;
297    height: 260px;
298}
299.percent-icon-size {
300    width: 100%;
301    max-width: 100%;
302}
303

From here, you could do a couple things

Either keep the 2 columns but change the widths of them (maybe 70/30, etc.) or as you've already mentioned, use a media query and not have columns on smaller screen sizes. The following snippet is an example of the the 2nd approach:

1function openTab(tabName, event) {
2  event.target.classList.add("active-tile");
3  event.target.children[2].classList.add("arrow-up");
4  var i, x;
5  x = document.getElementsByClassName("content");
6  for (i = 0; i &lt; x.length; i++) {
7    x[i].style.display = "none";
8  }
9  document.getElementById(tabName).style.display = "block";
10
11  // Get all the tabs into a collection
12  // (don't use .getElementsByClassName()!)
13  let tabs = document.querySelectorAll(".tile");
14
15  // Set up a click event handler on each of the tabs
16  tabs.forEach(function (tab) {
17    tab.addEventListener("click", function (event) {
18      // Loop over all the tabs and remove the active class
19      tabs.forEach(function (tab) {
20        tab.classList.remove("active-tile");
21        tab.children[2].classList.remove("arrow-up");
22      });
23
24      // Set the background of the clicked tab
25      this.classList.add("active-tile");
26      tab.children[2].classList.add("arrow-up");
27    });
28  });
29}
30function closeTab(tabName, event) {
31  x = document.getElementsByClassName("content");
32  for (i = 0; i &lt; x.length; i++) {
33    x[i].style.display = "none";
34  }
35  let tabs = document.querySelectorAll(".tile");
36  tabs.forEach(function (tab) {
37    tab.classList.remove("active-tile");
38    tab.children[2].classList.remove("arrow-up");
39  });
40}body {
41  margin: 0;
42  font-family: Arial, Helvetica, sans-serif;
43}
44
45.graph-section {
46  padding-top: 70px;
47}
48
49.section-content-specialisms {
50  max-width: $page-width;
51  margin: 0 auto;
52  padding: 0 $p-base;
53  margin-bottom: 70px;
54
55  justify-content: space-between;
56  position: relative;
57}
58
59@media (min-width: $tablets) {
60  .section-content-specialisms {
61    flex-direction: row;
62    padding-left: 2rem;
63    padding-right: 2rem;
64  }
65}
66
67.box {
68  display: flex;
69  flex-wrap: wrap;
70  flex-direction: row;
71  padding-right: 6rem;
72  padding-left: 6rem;
73}
74
75.tile,
76.active-tile,
77.content {
78  box-sizing: border-box;
79}
80
81.tile &gt; * {
82  pointer-events: none;
83}
84
85.tile {
86  flex: 1 0 auto;
87  order: 0;
88  flex-basis: 25%;
89  border: 1px solid grey;
90
91  /* For visual only  */
92  background-color: #222;
93  height: 150px;
94  text-align: center;
95  font-size: 16px;
96  color: white;
97  cursor: pointer;
98}
99
100.active-tile {
101  flex: 1 0 auto;
102  order: 0;
103  flex-basis: 25%;
104
105  /* For visual only  */
106  text-align: center;
107  border: 1px solid #000;
108  background-color: green;
109  cursor: pointer;
110}
111
112.content {
113  order: 1;
114  flex: 1 0 100%;
115
116  /* For visual only  */
117  padding: 20px;
118  color: black;
119  text-align: center;
120  border: 1px solid #000;
121  background-color: #228b22;
122}
123
124.description {
125  text-align: left;
126}
127
128.spec-info {
129  text-align: left;
130  width: 50%;
131  float: left;
132}
133
134.percent-icon-size {
135  width: 295px;
136  height: 260px;
137}
138
139.icon-percent {
140  width: 50%;
141  float: right;
142}
143
144.icon-spacing {
145  margin-top: 24px;
146}
147
148/* Clear floats after the tiles */
149.box:after {
150  content: "";
151  display: table;
152  clear: both;
153}
154
155.closebtn {
156  float: right;
157  color: black;
158  cursor: pointer;
159}
160
161.arrow-down {
162  width: 25px;
163  height: 25px;
164}
165
166.arrow-up {
167  width: 25px;
168  height: 25px;
169  -webkit-transform: rotate(180deg);
170  -moz-transform: rotate(180deg);
171  -ms-transform: rotate(180deg);
172  -o-transform: rotate(180deg);
173  transform: rotate(180deg);
174}
175
176.specialisms-content {
177  padding-top: 25px;
178  padding-bottom: 25px;
179}
180
181.percentage {
182  color: #228b22;
183}
184
185/* 
186  "Desktop" and above
187 */
188@media (max-width: 480px) {
189  .box {
190    flex-direction: column;
191    padding-right: 1rem;
192    padding-left: 1rem;
193  }
194
195  .content {
196    order: 0;
197  }
198}
199
200@media (max-width: 768px) {
201  .box {
202    padding-right: 1rem;
203    padding-left: 1rem;
204  }
205}&lt;div class="box"&gt;
206   &lt;div class="tile" onclick="openTab('b1', event);"&gt;
207        &lt;img class="icon-spacing" src="./assets/Icons/Banking.svg" /&gt;
208        &lt;p&gt;Banking&lt;/p&gt;
209        &lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
210      &lt;/div&gt;
211      &lt;div
212        id="b1"
213        class="content"
214        style="display: none; background: white"
215      &gt;
216        &lt;span onclick="closeTab('b1', event)" class="closebtn"
217          &gt;&amp;times;&lt;/span
218        &gt;
219        &lt;div class="expanded-content"&gt;&lt;/div&gt;
220
221        &lt;div class="spec-info"&gt;
222          &lt;h3&gt;Banking&lt;/h3&gt;
223          &lt;p&gt;
224            Core banking products including personal current accounts,
225            savings and mortgages. This category also includes banking
226            platforms and operations FinTechs such as Railsbank and
227            challenger banks such as Atom.
228          &lt;/p&gt;
229          &lt;ul&gt;
230            &lt;li&gt;Banking Personal Current Accounts (PCA)&lt;/li&gt;
231            &lt;li&gt;Banking Platforms&lt;/li&gt;
232            &lt;li&gt;Banking Operations&lt;/li&gt;
233          &lt;/ul&gt;
234        &lt;/div&gt;
235        &lt;div class="icon-percent"&gt;
236          &lt;img src="./assets/37.png" alt="" class="percent-icon-size" /&gt;
237        &lt;/div&gt;
238      &lt;/div&gt;
239&lt;div class="tile" onclick="openTab('b2', event);"&gt;
240&lt;img class="icon-spacing" src="./assets/Icons/Regtech.svg" /&gt;
241&lt;p&gt;RegTech&lt;/p&gt;
242&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
243&lt;/div&gt;
244&lt;div id="b2" class="content" style="display: none; background: white"&gt;
245&lt;span onclick="closeTab('b2', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
246&lt;div class="description"&gt;
247&lt;h3&gt;RegTech - &lt;span class="percentage"&gt;10%&lt;/span&gt;&lt;/h3&gt;
248&lt;p&gt;
249  This FinTech category focuses on companies with activities and
250  technology focused on reimagining and streamlining risk (AML, KYC),
251  credit scoring and compliance software.
252&lt;/p&gt;
253&lt;/div&gt;
254&lt;/div&gt;
255&lt;div class="tile" onclick="openTab('b3', event);"&gt;
256&lt;img class="icon-spacing" src="./assets/Icons/InsurTech.svg" /&gt;
257&lt;p&gt;InsurTech&lt;/p&gt;
258&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
259&lt;/div&gt;
260&lt;div id="b3" class="content" style="display: none; background: white"&gt;
261&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
262&lt;div class="description"&gt;
263&lt;h3&gt;InsurTech - &lt;span class="percentage"&gt;6%&lt;/span&gt;&lt;/h3&gt;
264&lt;p&gt;
265  InsurTech includes companies selling insurance digitally or introducing
266  new business models or (re)insurance specific software.
267&lt;/p&gt;
268&lt;ul&gt;
269  &lt;li&gt;InsurTech - Commercial&lt;/li&gt;
270  &lt;li&gt;InsurTech - Personal&lt;/li&gt;
271  &lt;li&gt;Insurance Platforms and Operations&lt;/li&gt;
272&lt;/ul&gt;
273&lt;/div&gt;
274&lt;/div&gt;
275&lt;div class="tile" onclick="openTab('b4', event);"&gt;
276&lt;img class="icon-spacing" src="./assets/Icons/Lending.svg" /&gt;
277&lt;p&gt;Lending&lt;/p&gt;
278&lt;img class="arrow-down" src="./assets/Icons/arrow-down.png" /&gt;
279&lt;/div&gt;
280&lt;div id="b4" class="content" style="display: none; background: white"&gt;
281&lt;span onclick="closeTab('b3', event)" class="closebtn"&gt;&amp;times;&lt;/span&gt;
282&lt;div class="description"&gt;
283&lt;h3&gt;Lending - &lt;span class="percentage"&gt;13%&lt;/span&gt;&lt;/h3&gt;
284&lt;p&gt;
285  Companies focused on innnovating credit, from commerical to alternative
286  and specialist lenders or platforms facilitating P2P.
287&lt;/p&gt;
288&lt;ul&gt;
289  &lt;li&gt;Consumer Lending&lt;/li&gt;
290  &lt;li&gt;Commercial Lending&lt;/li&gt;
291  &lt;li&gt;P2P Lending&lt;/li&gt;
292&lt;/ul&gt;
293&lt;/div&gt;
294&lt;/div&gt;
295&lt;/div&gt;.percent-icon-size {
296    width: 295px;
297    height: 260px;
298}
299.percent-icon-size {
300    width: 100%;
301    max-width: 100%;
302}
303// Mobile, single column
304// If you're using any other &quot;Mobile First&quot; approaches, 
305// you may not need the media query
306// 
307// I'm arbitrarily selecting a max-width pixel value;  
308// you'd want to update this according to your needs.
309@media (max-width: 767px) {
310    .spec-info, .icon-percent {
311        width: 100%;
312        float: none;
313    }
314
315    .percent-icon-size {
316        width: 100%;
317        max-width: 100%;
318    }
319}
320

Hope this helps, happy coding.

Source https://stackoverflow.com/questions/66551993

QUESTION

How can I solve the npm run dev error I'm facing after creating a new Laravel 7 project?

Asked 2021-Feb-23 at 09:47

I have created a new Laravel 7 project and after doing so, ran the command npm install and all the packages in my package.json were downloaded into the node_modules directory. Then i tried running the command npm run dev and keeps on failing.

I'm using the following versions

  • PHP 7.4.11
  • Laravel installer 4.11
  • Node v15.0.1
  • npm 7.0.3
  • Composer 2.0.9

This is my package.json file

1{
2&quot;private&quot;: true,
3&quot;scripts&quot;: {
4    &quot;dev&quot;: &quot;npm run development&quot;,
5    &quot;development&quot;: &quot;cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js&quot;,
6    &quot;watch&quot;: &quot;npm run development -- --watch&quot;,
7    &quot;watch-poll&quot;: &quot;npm run watch -- --watch-poll&quot;,
8    &quot;hot&quot;: &quot;cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js&quot;,
9    &quot;prod&quot;: &quot;npm run production&quot;,
10    &quot;production&quot;: &quot;cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js&quot;
11},
12&quot;devDependencies&quot;: {
13    &quot;autoprefixer&quot;: &quot;^10.2.4&quot;,
14    &quot;axios&quot;: &quot;^0.21.1&quot;,
15    &quot;cross-env&quot;: &quot;^7.0.3&quot;,
16    &quot;laravel-mix&quot;: &quot;^5.0.1&quot;,
17    &quot;lodash&quot;: &quot;^4.17.13&quot;,
18    &quot;resolve-url-loader&quot;: &quot;^3.1.0&quot;,
19    &quot;sass&quot;: &quot;^1.15.2&quot;,
20    &quot;sass-loader&quot;: &quot;^8.0.0&quot;,
21    &quot;webpack&quot;: &quot;^5.21.2&quot;,
22    &quot;webpack-cli&quot;: &quot;^4.5.0&quot;
23},
24&quot;name&quot;: &quot;MyProject&quot;
25}
26

This is the error I get after running npm run watch or npm run dev

1{
2&quot;private&quot;: true,
3&quot;scripts&quot;: {
4    &quot;dev&quot;: &quot;npm run development&quot;,
5    &quot;development&quot;: &quot;cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js&quot;,
6    &quot;watch&quot;: &quot;npm run development -- --watch&quot;,
7    &quot;watch-poll&quot;: &quot;npm run watch -- --watch-poll&quot;,
8    &quot;hot&quot;: &quot;cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js&quot;,
9    &quot;prod&quot;: &quot;npm run production&quot;,
10    &quot;production&quot;: &quot;cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js&quot;
11},
12&quot;devDependencies&quot;: {
13    &quot;autoprefixer&quot;: &quot;^10.2.4&quot;,
14    &quot;axios&quot;: &quot;^0.21.1&quot;,
15    &quot;cross-env&quot;: &quot;^7.0.3&quot;,
16    &quot;laravel-mix&quot;: &quot;^5.0.1&quot;,
17    &quot;lodash&quot;: &quot;^4.17.13&quot;,
18    &quot;resolve-url-loader&quot;: &quot;^3.1.0&quot;,
19    &quot;sass&quot;: &quot;^1.15.2&quot;,
20    &quot;sass-loader&quot;: &quot;^8.0.0&quot;,
21    &quot;webpack&quot;: &quot;^5.21.2&quot;,
22    &quot;webpack-cli&quot;: &quot;^4.5.0&quot;
23},
24&quot;name&quot;: &quot;MyProject&quot;
25}
26&gt; dev
27&gt; npm run development
28
29
30&gt; development
31&gt; cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules - 
32 -config=node_modules/laravel-mix
33/setup/webpack.config.js
34npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c &quot;cross-env NODE_ENV=development 
35node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-
36mix/setup/webpack.config.js&quot;
37
38npm ERR! A complete log of this run can be found in:
39npm ERR!     C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_575Z- 
40debug.log
41npm ERR! code 2
42npm ERR! path C:\Users\Rolling Sure\Desktop\Code Fintech\duplicate\MyProject
43npm ERR! command failed
44npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c &quot;npm run development&quot;
45
46npm ERR! A complete log of this run can be found in:
47npm ERR!     C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_652Z- 
48debug.log
49

ANSWER

Answered 2021-Feb-23 at 09:47

You could try reinstalling the node packages.

  • Delete the node_modules folder.
  • run npm install again

Source https://stackoverflow.com/questions/66205774

QUESTION

getting error when trying to convert object column into int

Asked 2021-Feb-07 at 08:53

I have a dataframe in which few of the columns are object, and I want to change one of them into a int column so I can work with it. and do some calculation. but when ever am trying to do it am getting this error.

here's my code.

code which giving me the error.

1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4

error

1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4    ---------------------------------------------------------------------------
5ValueError                                Traceback (most recent call last)
6&lt;ipython-input-21-b9d8d4e75b08&gt; in &lt;module&gt;
7----&gt; 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10   5870         else:
11   5871             # else, only a single dtype is given
12-&gt; 5872             new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13   5873             return self._constructor(new_data).__finalize__(self, method=&quot;astype&quot;)
14   5874 
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17    629         self, dtype, copy: bool = False, errors: str = &quot;raise&quot;
18    630     ) -&gt; &quot;BlockManager&quot;:
19--&gt; 631         return self.apply(&quot;astype&quot;, dtype=dtype, copy=copy, errors=errors)
20    632 
21    633     def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24    425                     applied = b.apply(f, **kwargs)
25    426                 else:
26--&gt; 427                     applied = getattr(b, f)(**kwargs)
27    428             except (TypeError, NotImplementedError):
28    429                 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31    671             vals1d = values.ravel()
32    672             try:
33--&gt; 673                 values = astype_nansafe(vals1d, dtype, copy=True)
34    674             except (ValueError, TypeError):
35    675                 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38   1072         # work around NumPy brokenness, #1987
39   1073         if np.issubdtype(dtype.type, np.integer):
40-&gt; 1074             return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41   1075 
42   1076         # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
47

info about the data frame.

1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4    ---------------------------------------------------------------------------
5ValueError                                Traceback (most recent call last)
6&lt;ipython-input-21-b9d8d4e75b08&gt; in &lt;module&gt;
7----&gt; 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10   5870         else:
11   5871             # else, only a single dtype is given
12-&gt; 5872             new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13   5873             return self._constructor(new_data).__finalize__(self, method=&quot;astype&quot;)
14   5874 
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17    629         self, dtype, copy: bool = False, errors: str = &quot;raise&quot;
18    630     ) -&gt; &quot;BlockManager&quot;:
19--&gt; 631         return self.apply(&quot;astype&quot;, dtype=dtype, copy=copy, errors=errors)
20    632 
21    633     def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24    425                     applied = b.apply(f, **kwargs)
25    426                 else:
26--&gt; 427                     applied = getattr(b, f)(**kwargs)
27    428             except (TypeError, NotImplementedError):
28    429                 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31    671             vals1d = values.ravel()
32    672             try:
33--&gt; 673                 values = astype_nansafe(vals1d, dtype, copy=True)
34    674             except (ValueError, TypeError):
35    675                 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38   1072         # work around NumPy brokenness, #1987
39   1073         if np.issubdtype(dtype.type, np.integer):
40-&gt; 1074             return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41   1075 
42   1076         # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470   Sr No              3044 non-null   int64 
48 1   Date dd/mm/yyyy    3044 non-null   object
49 2   Startup Name       3044 non-null   object
50 3   Industry Vertical  2873 non-null   object
51 4   SubVertical        2108 non-null   object
52 5   City  Location     2864 non-null   object
53 6   Investors Name     3020 non-null   object
54 7   InvestmentnType    3040 non-null   object
55 8   Amount in USD      2084 non-null   object
56 9   Remarks            419 non-null    object
57

here the sample of my data frame

1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4    ---------------------------------------------------------------------------
5ValueError                                Traceback (most recent call last)
6&lt;ipython-input-21-b9d8d4e75b08&gt; in &lt;module&gt;
7----&gt; 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10   5870         else:
11   5871             # else, only a single dtype is given
12-&gt; 5872             new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13   5873             return self._constructor(new_data).__finalize__(self, method=&quot;astype&quot;)
14   5874 
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17    629         self, dtype, copy: bool = False, errors: str = &quot;raise&quot;
18    630     ) -&gt; &quot;BlockManager&quot;:
19--&gt; 631         return self.apply(&quot;astype&quot;, dtype=dtype, copy=copy, errors=errors)
20    632 
21    633     def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24    425                     applied = b.apply(f, **kwargs)
25    426                 else:
26--&gt; 427                     applied = getattr(b, f)(**kwargs)
27    428             except (TypeError, NotImplementedError):
28    429                 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31    671             vals1d = values.ravel()
32    672             try:
33--&gt; 673                 values = astype_nansafe(vals1d, dtype, copy=True)
34    674             except (ValueError, TypeError):
35    675                 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38   1072         # work around NumPy brokenness, #1987
39   1073         if np.issubdtype(dtype.type, np.integer):
40-&gt; 1074             return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41   1075 
42   1076         # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470   Sr No              3044 non-null   int64 
48 1   Date dd/mm/yyyy    3044 non-null   object
49 2   Startup Name       3044 non-null   object
50 3   Industry Vertical  2873 non-null   object
51 4   SubVertical        2108 non-null   object
52 5   City  Location     2864 non-null   object
53 6   Investors Name     3020 non-null   object
54 7   InvestmentnType    3040 non-null   object
55 8   Amount in USD      2084 non-null   object
56 9   Remarks            419 non-null    object
57Sr No   Date dd/mm/yyyy Startup Name    Industry Vertical   SubVertical City Location   Investors Name  InvestmentnType Amount in USD   Remarks
580   1   09/01/2020  BYJU’S  E-Tech  E-learning  Bengaluru   Tiger Global Management Private Equity Round    20,00,00,000    NaN
591   2   13/01/2020  Shuttl  Transportation  App based shuttle service   Gurgaon Susquehanna Growth Equity   Series C    80,48,394   NaN
602   3   09/01/2020  Mamaearth   E-commerce  Retailer of baby and toddler products   Bengaluru   Sequoia Capital India   Series B    1,83,58,860 NaN
613   4   02/01/2020  https://www.wealthbucket.in/    FinTech Online Investment   New Delhi   Vinod Khatumal  Pre-series A    30,00,000   NaN
62

ANSWER

Answered 2021-Feb-07 at 08:53

There is a categorical variable instance 'undisclosed' in your df['Amount in USD'] which cannot be converted to int per se.

You need to map values that are not numeric with string type on your own, i.e.:

1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4    ---------------------------------------------------------------------------
5ValueError                                Traceback (most recent call last)
6&lt;ipython-input-21-b9d8d4e75b08&gt; in &lt;module&gt;
7----&gt; 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10   5870         else:
11   5871             # else, only a single dtype is given
12-&gt; 5872             new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13   5873             return self._constructor(new_data).__finalize__(self, method=&quot;astype&quot;)
14   5874 
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17    629         self, dtype, copy: bool = False, errors: str = &quot;raise&quot;
18    630     ) -&gt; &quot;BlockManager&quot;:
19--&gt; 631         return self.apply(&quot;astype&quot;, dtype=dtype, copy=copy, errors=errors)
20    632 
21    633     def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24    425                     applied = b.apply(f, **kwargs)
25    426                 else:
26--&gt; 427                     applied = getattr(b, f)(**kwargs)
27    428             except (TypeError, NotImplementedError):
28    429                 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31    671             vals1d = values.ravel()
32    672             try:
33--&gt; 673                 values = astype_nansafe(vals1d, dtype, copy=True)
34    674             except (ValueError, TypeError):
35    675                 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38   1072         # work around NumPy brokenness, #1987
39   1073         if np.issubdtype(dtype.type, np.integer):
40-&gt; 1074             return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41   1075 
42   1076         # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470   Sr No              3044 non-null   int64 
48 1   Date dd/mm/yyyy    3044 non-null   object
49 2   Startup Name       3044 non-null   object
50 3   Industry Vertical  2873 non-null   object
51 4   SubVertical        2108 non-null   object
52 5   City  Location     2864 non-null   object
53 6   Investors Name     3020 non-null   object
54 7   InvestmentnType    3040 non-null   object
55 8   Amount in USD      2084 non-null   object
56 9   Remarks            419 non-null    object
57Sr No   Date dd/mm/yyyy Startup Name    Industry Vertical   SubVertical City Location   Investors Name  InvestmentnType Amount in USD   Remarks
580   1   09/01/2020  BYJU’S  E-Tech  E-learning  Bengaluru   Tiger Global Management Private Equity Round    20,00,00,000    NaN
591   2   13/01/2020  Shuttl  Transportation  App based shuttle service   Gurgaon Susquehanna Growth Equity   Series C    80,48,394   NaN
602   3   09/01/2020  Mamaearth   E-commerce  Retailer of baby and toddler products   Bengaluru   Sequoia Capital India   Series B    1,83,58,860 NaN
613   4   02/01/2020  https://www.wealthbucket.in/    FinTech Online Investment   New Delhi   Vinod Khatumal  Pre-series A    30,00,000   NaN
62df['Amount in USD'] = df['Amount in USD'].replace('undisclosed', '-1')
63df['Amount in USD'] = df['Amount in USD'].astype(int)
64

I make the assumption here, that there is no '-1' values in your df['Amount in USD'] column. You can check the unique values for that column like so:

1df['Amount in USD']=df['Amount in USD'].str.replace(',', '') #this worked fine
2
3df['Amount in USD']=df['Amount in USD'].astype(int) #but this doesn't
4    ---------------------------------------------------------------------------
5ValueError                                Traceback (most recent call last)
6&lt;ipython-input-21-b9d8d4e75b08&gt; in &lt;module&gt;
7----&gt; 1 df['Amount in USD']=df['Amount in USD'].astype(int)
8
9/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/generic.py in astype(self, dtype, copy, errors)
10   5870         else:
11   5871             # else, only a single dtype is given
12-&gt; 5872             new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
13   5873             return self._constructor(new_data).__finalize__(self, method=&quot;astype&quot;)
14   5874 
15
16/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in astype(self, dtype, copy, errors)
17    629         self, dtype, copy: bool = False, errors: str = &quot;raise&quot;
18    630     ) -&gt; &quot;BlockManager&quot;:
19--&gt; 631         return self.apply(&quot;astype&quot;, dtype=dtype, copy=copy, errors=errors)
20    632 
21    633     def convert(
22
23/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/managers.py in apply(self, f, align_keys, ignore_failures, **kwargs)
24    425                     applied = b.apply(f, **kwargs)
25    426                 else:
26--&gt; 427                     applied = getattr(b, f)(**kwargs)
27    428             except (TypeError, NotImplementedError):
28    429                 if not ignore_failures:
29
30/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/internals/blocks.py in astype(self, dtype, copy, errors)
31    671             vals1d = values.ravel()
32    672             try:
33--&gt; 673                 values = astype_nansafe(vals1d, dtype, copy=True)
34    674             except (ValueError, TypeError):
35    675                 # e.g. astype_nansafe can fail on object-dtype of strings
36
37/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in astype_nansafe(arr, dtype, copy, skipna)
38   1072         # work around NumPy brokenness, #1987
39   1073         if np.issubdtype(dtype.type, np.integer):
40-&gt; 1074             return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
41   1075 
42   1076         # if we have a datetime/timedelta array of objects
43
44pandas/_libs/lib.pyx in pandas._libs.lib.astype_intsafe()
45
46ValueError: invalid literal for int() with base 10: 'undisclosed'
470   Sr No              3044 non-null   int64 
48 1   Date dd/mm/yyyy    3044 non-null   object
49 2   Startup Name       3044 non-null   object
50 3   Industry Vertical  2873 non-null   object
51 4   SubVertical        2108 non-null   object
52 5   City  Location     2864 non-null   object
53 6   Investors Name     3020 non-null   object
54 7   InvestmentnType    3040 non-null   object
55 8   Amount in USD      2084 non-null   object
56 9   Remarks            419 non-null    object
57Sr No   Date dd/mm/yyyy Startup Name    Industry Vertical   SubVertical City Location   Investors Name  InvestmentnType Amount in USD   Remarks
580   1   09/01/2020  BYJU’S  E-Tech  E-learning  Bengaluru   Tiger Global Management Private Equity Round    20,00,00,000    NaN
591   2   13/01/2020  Shuttl  Transportation  App based shuttle service   Gurgaon Susquehanna Growth Equity   Series C    80,48,394   NaN
602   3   09/01/2020  Mamaearth   E-commerce  Retailer of baby and toddler products   Bengaluru   Sequoia Capital India   Series B    1,83,58,860 NaN
613   4   02/01/2020  https://www.wealthbucket.in/    FinTech Online Investment   New Delhi   Vinod Khatumal  Pre-series A    30,00,000   NaN
62df['Amount in USD'] = df['Amount in USD'].replace('undisclosed', '-1')
63df['Amount in USD'] = df['Amount in USD'].astype(int)
64`df['Amount in USD']`.unique()
65

Feel free to add those contents to your question so I can assist you further.


EDIT Bonus:

Depending on what calculations you want to perform on that column you need to carefully select the integers. There are several good guides available online:

Make sure that it also fits your domain which does look like finance to me.

Source https://stackoverflow.com/questions/66085735

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Fintech

Share this Page

share link

Get latest updates on Fintech