I have a php scraper that I wrote that scrapes <td class="title>job title tags from a job hunting website and stores it in a PHP variable. The problem is that the href is a relative link (just folder directories) and when I use it on my site it appends my domain name instead of the job hosting site’s domain name.
I tried to use str_replace() but I can’t seem to get it to do anything. Here’s my snippet of PHP
[PHP] //scraping job title and url to job listing
//appends brando56894.dyndns-blog.com to url instead of http://huntersandgatherers.jobamatic.com/
$regex_title= “/<td class=“title”>(.+?)</td>/”;
preg_match_all($regex_title,$scraped_page,$scraped_title_data);
for($k=0;$k<5;$k++) { $job_title = $scraped_title_data[1][$k];}
//doesn’t work
$brando = urlencode(“http://brando56894.dyndns-blog.com:1085”);
$hunter = urlencode(“http://huntersandgatherers.jobamatic.com”);
$job_title = str_replace($brando, $hunter, $job_title);
//doesn’t work
echo $job_title;[/PHP]