WordPress / WordPress/Requests

Works in Localhost does not work in webserver

Open
#235 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

I am trying to fetch contents from

https://some.com/suggestions.php?q=kann

include('./Request/library/Requests.php');
Requests::register_autoloader();
$request = Requests::get('https://some.com/suggestions.php?q=kann',array('Accept' => 'application/json'));
echo json_encode($request->body);

Above code works fine when we run on localHost But I get

"500 Internal server error

PhP Error Shows

`

Fatal error: Uncaught exception 'Requests_Exception' with message 'cURL error 28: Operation timed out after 10000 milliseconds with 0 bytes received' in /home/admin/domains/domain.com/public_html/Request/library/Requests/Transport/cURL.php:277 Stack trace: #0 /home/admin/domains/domain.com/public_html/Request/library/Requests/Transport/cURL.php(120): Requests_Transport_cURL->process_response(false, Array) #1 /home/admin/domains/domain.com/public_html/Request/library/Requests.php(317): Requests_Transport_cURL->request('https://some.com...', Array, NULL, Array) #2 /home/admin/domains/domain.com/public_html/Request/library/Requests.php(194): Requests::request('https://some.com...', Array, NULL, 'GET', Array) #3 /home/admin/domains/domain.com/public_html/Request/examples/get.php(14): Requests::get('https://some.com...', Array) #4 {main} thrown in /home/admin/domains/domain.com/public_html/Request/library/Requests/Transport/cURL.php on line 277

`

when run on webserver, is there any way to fix this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Request/library/Requests/Transport/cURL.php:277 and follow the request path through Requests.php:317 and Requests.php:194. Compare the PHP and cURL environment used by localhost and the webserver, including access to the requested URL. Done means identifying whether the timeout is an environment-specific problem or a reproducible Requests defect.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.