Hi All,
Hoping you can help, have spent many an hour and searching around and not finding much. I have a main php program running and I wish to make a call to execute a JSP page, sounds simple enough. I have tried include but did not work, header location but this causes header redirect problems and curl which does not work? Also tried file_get_contents, did not work either? I wish to stay in my main.php program and not get redirected, just make a call and successfully execute the JSP page running on another server? Hope this is clear, any help much appreciated.
this works…
[php]<?php
$homepage = file_get_contents(‘http://www.example.com/’);
echo $homepage;
?>[/php]
but this does not work
[php]<?php
$homepage = file_get_contents(‘http://hostname:8080/pagename.jsp?param1=value1¶m2=value2/’);
echo $homepage;
?>[/php]
just times out…
have also tried CURL, also times out.
[php]
$URL =‘http://hostname:8080/pagename.jsp?param1=value1¶m2=value2’;
//Initialize the Curl session
$ch = curl_init();
//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Set the URL
curl_setopt($ch, CURLOPT_URL, $URL);
//Execute the fetch
$data = curl_exec($ch) or die(curl_error($ch));
//Close the connection
curl_close($ch);
print $data;
[/php]