phoenixx Posted August 3, 2008 Share Posted August 3, 2008 I know this is easy but I'm getting an error. I'm scraping an external page of one of my other sites and using the following code w/ the following error: <?php $data = fopen("http://post.XXXXXXX.org/XXXXX/XXX/x/", "r"); ; preg_match_all('/<input.*?name="([^"]*)".*?value="([^"]*)"/is',$data,$out); $d = array_combine($out[1], $out[2]); print_r($d); ?> Error: Warning: preg_match_all() expects parameter 2 to be string, resource given in /home/XXXX/public_html/sandbox/post1.php on line 3 Warning: array_combine() expects parameter 1 to be array, null given in /home/kennyaar/public_html/sandbox/post1.php on line 4 Link to comment https://forums.phpfreaks.com/topic/117900-get-html-from-external-page/ Share on other sites More sharing options...
genericnumber1 Posted August 3, 2008 Share Posted August 3, 2008 Change fopen to file_get_contents and remove the second parameter, you're accidentally using the wrong function. Link to comment https://forums.phpfreaks.com/topic/117900-get-html-from-external-page/#findComment-606474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.