Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

call asp URL in php page (includes?)

Posted on 2007-04-04
10
Medium Priority
?
324 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

670 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