How do i use GET requests using cURL?

How are you displaying the output without using echo ??

<?php
$favorites_number = file_get_contents("https://api.bloxstargames.cf/gba/v1/favorites.php");
echo $favorites_number; ?>
1 Like

It’s still not working

image

It seems that Cloudflare blocks the requests. I have Strict ssl enabled and Bot fight mode enabled. What to do? When i use pastebin the request works.

Because
image

Use option 1.

So i will have to put the code from favorites.php into index.php?

No. Read about how to use an include and then you will understand.

https://www.php.net/manual/en/function.include.php

1 Like

Can you give me an example in my case because i tried doing that and it didn’t work.

Then you can just do as you said.

It works but is there a way to use it with the url?

Also how do i get content from a JSON file with multiple sections:
image

Here are some tutorials:

e class="onebox allowlistedgeneric" data-onebox-src="https://www.w3schools.com/Php/php_json.asp">
w3schools.com

PHP and JSON

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

https://www.php.net/manual/en/function.stream-get-contents.php

3 Likes

I know we have told you this before.

We are not going to just give you code, especially if you don’t understand the concept. If we do just hand you code, you won’t understand it, and it certainly will not help you in the long run.

The tutorials @wackyblackie shared are good ones, and will get you well on your way to understanding what you need to in order to successfully complete the task.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.