Solved

call asp URL in php page (includes?)

Posted on 2007-04-04
10
323 Views
Last Modified: 2007-12-19
is there anway i can call this

http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225

in a php includes? or some such thing - i want to show it on a php page, fit it into my site's look/feel.

thanks!
0
Comment
Question by:phillystyle123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 11

Expert Comment

by:f_o_o_k_y
ID: 18856409

Maybe something like this:

HTML code:

<iframe src="http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225"   frameborder="1">
    ups...Your browser does not support frames
</iframe>
0
 
LVL 15

Expert Comment

by:babuno5
ID: 18856934
or may be you can try
$tmp_str_contents = file_get_contents("http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225");
All the contents from the remote site will be available in the variable and then you can print it out
0
 
LVL 11

Expert Comment

by:f_o_o_k_y
ID: 18858005
babuno5:
There mght be problem when URL is invalid or server is busy.

But if you want to do something with the content for example change or just include HTML inside your code then you must do as babuno5 said.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:babuno5
ID: 18859595
yes the problem can though be handled with a small check
$tmp_str_contents = file_get_contents("http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225");
if($tmp_str_contents === false)
{
//there was some problem making a call and may be show some custom error message
}
0
 

Author Comment

by:phillystyle123
ID: 18859902
thanks - what am i doing wrong here (i'm getting "application not available - but if i open the link in it's own window, it works fine")

<?php $tmp_str_contents = file_get_contents("http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225");
if($tmp_str_contents === false)
{
//there was some problem making a call and may be show some custom error message
}?>

<?php echo "$tmp_str_contents"; ?>
0
 
LVL 11

Expert Comment

by:f_o_o_k_y
ID: 18862893
Hello,
Dont kow why but it seems to be a problem with IIS on which the page is running.
I found 2 workarounds but only one i could test:
1. Require PECL

<?php
$body = http_parse_message(http_get($url))->body;
?>

2. Require much more code but works and does not require any additional things:
You can use this (tested):
This code sends HTTP request just like you would use telnet.

<?php

$sock = fsockopen("tcp://physfindweb.beryl.net", 80, $errno, $errstr, 30);

if (!$sock) die("$errstr ($errno)\n");



fwrite($sock, "GET /SearchForm.aspx?ClientID=3225 HTTP/1.0\r\n");

fwrite($sock, "Host: physfindweb.beryl.net\r\n");

fwrite($sock, "User-Agent: PHP \r\n");

fwrite($sock, "Accept: */*\r\n");

fwrite($sock, "\r\n");

fwrite($sock, "\r\n");





$headers = "";

while ($str = trim(fgets($sock, 4096)))

  $headers .= "$str\n";





$body = "";

while (!feof($sock))

  $body .= fgets($sock, 4096);





echo $body;



fclose($sock);



?>
0
 

Author Comment

by:phillystyle123
ID: 18865601
hi fooky - this works but:

1. it takes a while to load

2. the search results page goes to the main URL i.e.

http://mysite.com/SearchForm.aspx?ClientID=3225 - and that page doesn't exist.

i'm putting this at the top of the page:

<?php
$body = "http_parse_message(http_get($url))->body";
?>

and this in the body:

<?php

$sock = fsockopen("tcp://physfindweb.beryl.net", 80, $errno, $errstr, 30);

if (!$sock) die("$errstr ($errno)\n");



fwrite($sock, "GET  http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225 HTTP/1.0\r\n");

fwrite($sock, "Host: physfindweb.beryl.net\r\n");

fwrite($sock, "User-Agent: PHP \r\n");

fwrite($sock, "Accept: */*\r\n");

fwrite($sock, "\r\n");

fwrite($sock, "\r\n");





$headers = "";

while ($str = trim(fgets($sock, 4096)))

  $headers .= "$str\n";





$body = "";

while (!feof($sock))

  $body .= fgets($sock, 4096);





echo $body;



fclose($sock);



?>

(notice i changed the GET url to absolute but still getting the same result
0
 
LVL 11

Expert Comment

by:f_o_o_k_y
ID: 18866390
No no no :)

its a complete solution but require PECL
<?php
$body = "http_parse_message(http_get($url))->body";
?>

THIS is also a complete solution:
Dont use them together


0
 

Author Comment

by:phillystyle123
ID: 18866580
thanks fooky but still getting the same result - the URL:

http://goodsam.org/doctors/test.php

notice - takes a while to load and then when i submit the form i get my error page - note, i'm using solution 2 and NOT solution 1 - thanks again for your help with this!
0
 
LVL 11

Accepted Solution

by:
f_o_o_k_y earned 125 total points
ID: 18870227
Heh :) It's very simple answer why it's not working properly. When you submit form there is no page which can handle the request.
After you include form into your page you need to procede the request.

If you only want other serwer to answer for this question try using:
<iframe src="http://physfindweb.beryl.net/SearchForm.aspx?ClientID=3225"   frameborder="1">
    ups...Your browser does not support frames
</iframe>

Or catch the POST data and submit them by using fwirte to the orginal server and then proceed with another response.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question