Developer Community

Code. Debug. Build. Share.

Ask programming questions, share code, review projects, publish tutorials, and help other developers solve real problems.

// ProfoundSyntax
function community() {
  return [
    'ask',
    'learn',
    'build',
    'share'
  ];
}
Community Feed

Latest Discussions

0

PHP BABY

TESTING MULTI CODES:

html

  
ProfoundSyntax transfer ceiling test

  

This block should stay below the individual transfer limit.


  

Add enough harmless HTML text here so this block is roughly 600–700 characters.




css
.size-test {
  padding: 24px;
  border: 1px solid #ccc;
  font-family: sans-serif;
}

.size-test h2 {
  margin-bottom: 12px;
}

.size-test p {
  line-height: 1.6;
}

/* Add harmless comments here until this block is also roughly 600–700 characters. */

Tada!

Join Discussion
0

PHP API Request Times Out Even Though Endpoint Works

php

<?php if (is_user_logged_in());

?>

I am trying to make a PHP request to an external API, but the request periodically times out even though the API endpoint itself appears to be online and responding normally when I test it directly. The problem does not happen on every request. Some requests complete in less than a second, while others wait…

php
<?php

$url = 'https://api.example.com/products';

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTPHEADER => <span class="text-token-text-primary cursor-text rounded-sm" data-placeholder-token="true">[
        'Accept: application/json',
    ]</span>,
]);

$response = curl_exec($ch);

if ($response === false) {
    echo 'cURL Error: ' . curl_error($ch);
} else {
    $data = json_decode($response, true);

    echo '<pre>';
    print_r($data);
    echo '</pre>';
}

curl_close($ch);
Join Discussion Answered