Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to sent request in php

<?php
//The url you wish to send the POST request to
$url = $file_name;

//The data you want to send via POST
$fields = [
    '__VIEWSTATE '      => $state,
    '__EVENTVALIDATION' => $valid,
    'btnSubmit'         => 'Submit'
];

//url-ify the data for the POST
$fields_string = http_build_query($fields);

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); 

//execute post
$result = curl_exec($ch);
echo $result;
?>
Comment

PREVIOUS NEXT
Code Example
Php :: js unserialize 
Php :: Laravel adding Foreign Key Constraints 
Php :: permutations php 
Php :: laravel select max value 
Php :: model get last query in php 
Php :: define site url wordpress 
Php :: how to check confirm password in php 
Php :: resource controller artisan command 
Php :: php get day of week 
Php :: get type of object in php 
Php :: laravel wherenotin 
Php :: Update Query in Codeigniter Using Multiple Where Condition 
Php :: excerpt more wordpress 
Php :: make project in laravel 7 
Php :: create a custom method laravel model 
Php :: php loop 100 times 
Php :: instal phpgd2 
Php :: get_the_category() 
Php :: php print all woocommerce products 
Php :: if session is empty laravel 
Php :: how to get ip address of client in php 
Php :: laravel migration alter column unique 
Php :: php artisan route cache 
Php :: laravel controller update 
Php :: wpdb get last query 
Php :: smarty foreach 
Php :: phpmyadmin add foreign key 
Php :: how to get yearly chart in laravel 
Php :: eloquent get trashed record 
Php :: Load differenet .env file in laravel 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =