how to sent request in php

Solutions on MaxInterview for how to sent request in php by the best coders in the world

showing results for - "how to sent request in php"
Tim
16 Apr 2017
1$url = 'http://server.com/path';
2$data = array('key1' => 'value1', 'key2' => 'value2');
3
4// use key 'http' even if you send the request to https://...
5$options = array(
6    'http' => array(
7        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
8        'method'  => 'POST',
9        'content' => http_build_query($data)
10    )
11);
12$context  = stream_context_create($options);
13$result = file_get_contents($url, false, $context);
14if ($result === FALSE) { /* Handle error */ }
15
16var_dump($result);
17
Riccardo
10 Nov 2018
1<?php
2//The url you wish to send the POST request to
3$url = $file_name;
4
5//The data you want to send via POST
6$fields = [
7    '__VIEWSTATE '      => $state,
8    '__EVENTVALIDATION' => $valid,
9    'btnSubmit'         => 'Submit'
10];
11
12//url-ify the data for the POST
13$fields_string = http_build_query($fields);
14
15//open connection
16$ch = curl_init();
17
18//set the url, number of POST vars, POST data
19curl_setopt($ch,CURLOPT_URL, $url);
20curl_setopt($ch,CURLOPT_POST, true);
21curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
22
23//So that curl_exec returns the contents of the cURL; rather than echoing it
24curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); 
25
26//execute post
27$result = curl_exec($ch);
28echo $result;
29?>
30
queries leading to this page
php post exampleuse a to post phppost data using api in phphttp make post request to phppost data throug api in phpthis http post phpget post method in phpphp post valuehow to send post request in phpphp post request apipost api in phpphp post data apiphp send api keyphp post to apisend php post requestpass api phpphp get post methodphp send post requesphp send json to apisend post request from phpapi post value phphow to request api in php post requests in phppost method in phphow to send request to api in phpphp connect to api send request to api phpget data from post api phpsend post to php functionpost request html phpphp connect to api postdifferent ways of sending post request in phpget post methods in phpphp que post requestssend api request in php filesend api key on phpphp post api requestusing post in phpwhat are send and post method in phprequest 3epost 5b 5d in phppost in phpphp post requestphp 24posthow to make post request in php http post phphow to send the post request in phpserver request post phpsend post api phpphp make post requestphp post valueshow to access api value in phphow to send post request phpgetting post phpphp send to another php apicall post php send http request php 24post in phphow to call api with phpphp send request to apiwork api data with phppost method example in phpsend response to api call in phprequest is post phpmake a post request from phpphp request post parameters 24post phpget and post request phpphp post methodphp send http post requestphp example post requestphp http request postapi post request in phpget post request method in phpphp http postapi for sending sms in phpphp post 27how to get data using api in phphow to make a post request using phpphp request method posthow to use post in phppost from phpmake a post request using phppost method of the php function formmake post request in phpget api data in phphow to sent request in phppost and request in phpsend post request phprequest method post phpapi php send messagepost values in phpphp make a post requestphp 24 postphp post metodsent put request phpwhat is the function of get and post in phpsend request to api in phpwhat does post function in php doespost request phphow connect to api from phpphp send post requestpost get request in phpsend post request to the php functionphp post data using apiapi php send message phpis post method 3d post phphow to use post method in phphow to send a post request in phppost phpphp get post requestphp connect to api post request jsonphp do post requesthow to post php 24 post in phpsend a post request in phpm c3 a9thode post phpsyntax method post phppost get request phpphp send to php apisending a post request to api phphow to use api in phpphp method postmake post request phpphp call function using postpost call in phpsend get data in php apisending data to api phppost api phpmethod post phpphp request postpost data from api using php and html 24 post 28 22 22 29 php 24php postsend post request in phpphp pass object to apiadd data to api phpget post request phpmethod 3d post php send post request with phpsend post in phpget data from api phpphp send post http request phphow to make post calls in phphow to send page info in api php php api postpost on phpsend a post with phpphp post request examplephp send posthttp 3a 3apost phppost request to php serverphp value sent in phpget post and request method in phppost request in phpphp http post requestpost request using phppost requests phpphp is request posta post request in phppost data in php in apican we make a post request using phppost method in php with examplephp send request to rest apimake a post request phphow do i send a post request with phppost method phppost request with phphow connect with api from phpsimple php post request 27post 27 phpphp get post request methodhttp post to phphow to sent request in php