Käynnissä

Load contents of page after CURL operations

A page is called by CURL to do a form submission. What is required after that is to show the output of the page which was called, that is load that page. The page which needs to be loaded has its own cookies as well. A simple code is required to achieve this.

This is the curl part of the php code to do the form submission:

<?php

$ch = curl_init("http://mydomain/[url removed, login to view]");

$encoded = '';

// include GET as well as POST variables; your needs may vary.

foreach($_GET as $name => $value) {

$encoded .= urlencode($name).'='.urlencode($value).'&';

}

foreach($_POST as $name => $value) {

$encoded .= urlencode($name).'='.urlencode($value).'&';

}

// chop off last ampersand

$encoded = substr($encoded, 0, strlen($encoded)-1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);

curl_close($ch);

?>

Taidot: PHP

Näytä lisää: operations, load php, contents page, php curl http code, curl code, curl form value, encoded php, curl post form, form asp curl php, load page, page submission, php curl form post, php load, curl http post, curl_setopt, urlencode, page curl, curl php required, curl asp page, curl post asp page, curl form name, curl page asp, simple php curl, substr, post curl

Tietoa työnantajasta:
( 2 arvostelua ) blackwood, Australia

Projektin tunnus: #1697188

Myönnetty käyttäjälle:

marutichintan

Will Complete your Working in 10 Min

30 $ USD 1 päivässä
(1 arvostelu)
0.0