0

Can you please tell how to pass variables from php to aspx page, and how aspx can retrieve that values? after retrieving these values , aspx should return a 'success' response to php . php page should echo it . found that can redirect to aspx using

$url = "http://www.xxx.co/Default.aspx" ;
$param = "?" . "Field1=" . $num . "&Field2=" . $name . ";
header('Location: ' . $url . $param);
1
  • What is the actual problem here?
    – fast
    Aug 18, 2015 at 9:31

2 Answers 2

0

You can also do it with CURLas to show an alternative for using file_get_contents. As you are not explaining if you are using post or get I have build an example with get, but if you are going to use post, then ´CURL` is the best solution.

$url = "http://www.xxx.co/Default.aspx" ;
$param = "?" . "Field1=" . $num . "&Field2=" . $name;

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => $url. $param,
    CURLOPT_TIMEOUT => 30
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    return "error: " . $err;
} else {
    return $response;
}
0

You can try

<?php
$retString= file_get_contents($url . $param);
echo $retString;
?>

to get value back from other web page.

http://php.net/manual/en/function.file-get-contents.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.