Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中使用url从外部网站获取数据_Php_Html_Curl - Fatal编程技术网

在php中使用url从外部网站获取数据

在php中使用url从外部网站获取数据,php,html,curl,Php,Html,Curl,我想在我的web应用程序中加入一些来自外部网站的值,但它不起作用。 url如下所示: AXCDD12是使用表单传递的。 我用过卷发 $curl2=curl\u init(“http://www.misterauto.it/it/search_s_refoem_“$codice。”.html”); curl_setopt($curl2,CURLOPT_RETURNTRANSFER,1); $html2=curl\u exec($curl2); 如果(!空($2)){ $thispage=新文档;

我想在我的web应用程序中加入一些来自外部网站的值,但它不起作用。 url如下所示:

AXCDD12是使用表单传递的。 我用过卷发

$curl2=curl\u init(“http://www.misterauto.it/it/search_s_refoem_“$codice。”.html”);
curl_setopt($curl2,CURLOPT_RETURNTRANSFER,1);
$html2=curl\u exec($curl2);
如果(!空($2)){
$thispage=新文档;
libxml\u使用\u内部错误(true);
$thispage->loadHTML($html2);
libxml_clear_errors();
$xpath=newdomxpath($thispage);
如果(substr($codice,0,1)='A'){
$fornitore=“蓝图”;
$prezzoMA=$xpath->evaluate(//*[@id=“p brand10565”]/div/div[4]/div[1]/div[2]);
}else if(substr($codice,0,1)='F'){
$fornitore=“FERODO”;
$prezzoMA=$xpath->evaluate(//*[@id=“body”]/div[4]/div[2]/div/div[2]/div[2]/div/div[3]/div[3]/div[1]);
}否则{
$prezzoMA=$xpath->evaluate(//*[@id=“p-brand-21”]/div/div[4]/div[1]/div[2]);
}

}
您能否显示您迄今为止尝试的代码?如果我们不知道出了什么问题,我们就帮不了你。此外,该url不起作用,因此我们无法检查它为什么不起作用。$curl2=curl\u init(“);curl\u setopt($curl2,CURLOPT\u RETURNTRANSFER,1);$html2=curl\u exec($curl2);if(!empty($curl2)){$thispage=new DOMDocument;libxml\u use\u内部错误(true);$thispage->loadHTML($html2);libxml_clear_errors();$xpath=new DOMXPath($thispage);echo$prezzoMA;}我已经把代码什么是你得到的回应请张贴,以便我们可以帮助你谢谢你的消息,我已经添加了它!