WordPress / WordPress/Requests
HTTP(S) error
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 500
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Description
Hi,
I have this config:
$url = 'https://www.xxxx.com//wp-json/wp/v2/posts';
$data_headers = array(
"content-type" => "application/json;charset=utf-8"
);
$option = array(
"useragent" => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0"
);
$request = Requests::get($url, $data_headers, $option);
But, receiving this error:
Uncaught exception: Only HTTP(S) requests are handled:
(564)Terminating script: /home/app/admin/vendor/rmccue/requests/library/Requests.php
When use Curl, works:
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, True);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1');
$return = curl_exec($curl);
curl_close($curl);
Can you help me?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the request configuration shown in the issue and the error path in library/Requests.php. Reproduce the exception using the supplied URL and options, then determine whether the request is rejected because of its input or because of library behavior. Done means the cause is identified and the issue has a clear fix or documented usage correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100