English 中文(简体)
从另一个领域获得超文本
原标题:Get HTML from another domain
  • 时间:2012-04-24 15:31:23
  •  标签:
  • php
  • html
  • curl

我想在每30秒之间打上某种联系,并在我的节目中穿透。 是否有办法这样做?

我需要获得《法典》中的某些内容,这些内容总是定期改变。

I ve Trial using an iframe and take it s inner/60/8 but that don t work also php scode>file_get_contents() don t work.

最佳回答

Could you try using this? http://davidwalsh.name/download-urls-content-php-curl

法典

 /* gets the data from a URL */
function get_data($url)
{
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
  $data = curl_exec($ch);
  curl_close($ch);
  return $data;
}

然后打电话

$returned_content = get_data( http://davidwalsh.name );

(Credit to DAVID WALSH)

问题回答

<代码>file_get_content 由于其在服务器上残疾(可能是出于安全原因)。 你们要么能够这样做,要么使用《欧洲刑法》。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签