Hello,
Simple job for php/json/twig experts. need my json data array (pulled from an API source) to go to my twig loop
My current PHP code... (which works and Dump array structure for inspection using
var_dump($jsonData);
<?php
$postfields = array(
'username' => $api_username,
'password' => $api_password,
'action' => 'GetAnnouncements',
'responsetype' => 'json',
);
// Call the API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_hostname . 'includes/[login to view URL]');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
$response = curl_exec($ch);
if (curl_error($ch)) {
die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
}
curl_close($ch);
// Decode response
$jsonData = json_decode($response, true);
// Dump array structure for inspection
var_dump($jsonData);
// What I thought would work (but didn't)...
$twig->addGlobal('newsresults', $jsonData);
MY twig file
{% for news in newsresults %}
<h2>{{ [login to view URL] }}</h2>
<p>{{ [login to view URL] }}<br/>
{{ [login to view URL] }}
</p>
{% endfor %}
You can see my dump array output here;
[login to view URL]
This is a simple solution for experienced developers, I'm just new to the whole PHP world but have worked with developers for 10+ years my budget is maximum USD$20.00 and may take no longer than 30 minutes to complete from bid acceptance.
I can fix this twig issue for you.
My average project completion time is within 3-5 hours on the same day.
The skills I have include PHP, HTML5, CSS3, JavaScript, jQuery, WordPress Themes & Plugins, Web Scrapers & Automation Bots, User Scripts, Macros, and much more.
If you have any questions or concerns. Feel free to message me via chat to clarify any details.
Hi There
I am a senior software engineer with 10 years of practical programming experience. I have excellent
programming and development skills in various programming languages and frameworks. I am interested
in your project. I will provide an efficient, robust and well documented solution with dedicated
support. I will anticipate to discuss the details to get started.
Thanks
Farah Saif
Just 15 minutes task for me, give me the access and i will resolve it soon. Ready to start now. I am php/json expert. Handled several projects like that.
WEB Expert,
Hi there,
I have gone through your project detail and I have the Exact Match skills as per the current project you are looking now.
>> Kindly let me know the current website URL ?
I have 5+ years highly Experience in: Graphic & Web-Design| Shopify | Bootstrap| Responsive HTML5| PHP5| Wordpress| Angular.js | Laravel | CodeIgniter | SEO Services.
WHY-ME:
» No Upfront-Amount needed to Begin your Project
» Ready to Start as Immediate::,Unlimited Revisions & Proper Testing
» Keep your Data & Website Secure::, Daily Progress Updates
Let's have a quick Chat/PMB-Session to discuss & proceed!
Regards
Hello
I read your description carefully.
I can bring you the perfect result as you want.
I am an experienced web developer and designer with the depth knowledge related to PHP, Bootstrap, MySQL, JAVASCRIPT, jQuery, CSS, HTML, HTML5...
I can work at any time in your time zone.
Thanks for reading my bid proposal.
**For the success of your work***
hello,sir
****I am php expert.*******
I am not beginner.i have worked in IT company for 8 years.
I have read your requirements carefully and had trust i can complete task to a high level due to the development for 8 years during company.
I do not want many money, only good review.
if you make up your mind to hire me, i will do my best for the success of your work.
"your satisfaction is my pleasure and i will work for you forever, if you want ".
hoping for working with me for your project.
I appreciate if you trust me.
Thanks for considering.