PHP Fix HTTP Request
- or -
Post a project like this1767
£10/hr(approx. $13/hr)
- Posted:
- Proposals: 9
- Remote
- #2426680
- Awarded
Website Developer, Graphic Designer, Transcriber, Content writer, CAD Expert, Python Developer, Photo Editor, Web Scrapper, JAVA developer, Android developer, Wix/Shopify Expert,
Regensburg
AI & Data Science Engineer | Nodejs | Ruby On Rails | AWS | GCP | Python | React | Angular |
Auckland
TOP CERT DEVELOPER, eCommerce Web & Mobile Developer (PHP, Asp.Net ,Magento, Wordpress, WooCommerce)
Ramallah
Cake PHP, zend, Codeigniter, Laravel, Jquery,Smarty, WordPress , MYSQL developer and Mobile App Development
Delhi
17158882543778554344108868113333221612431172845525357382750301
Description
Experience Level: Entry
Hi,
Im looking to fix this HTTP request in PHP. Can somebody tell me what's wrong with this code. I need to get all response headers.
$url = '***********';
//$query = http_build_query ($params);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => ['Content-Type: application/json', 'Accept: application/json', 'host: ***********'],
'method' => 'POST',
'ignore_errors' => true,
'body' => '[{"***********":"***********","***********":"***********"}]'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, FALSE, $context);
echo json_encode(get_headers($url));
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
Im looking to fix this HTTP request in PHP. Can somebody tell me what's wrong with this code. I need to get all response headers.
$url = '***********';
//$query = http_build_query ($params);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => ['Content-Type: application/json', 'Accept: application/json', 'host: ***********'],
'method' => 'POST',
'ignore_errors' => true,
'body' => '[{"***********":"***********","***********":"***********"}]'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, FALSE, $context);
echo json_encode(get_headers($url));
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
Ben S.
100% (36)Projects Completed
23
Freelancers worked with
23
Projects awarded
28%
Last project
7 Feb 2021
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies