Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 15th Nov 2014, 02:46 AM   #1
Warrior Member
 
Join Date: 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
how to post text from url in wordpress?
Share on: 
fb share twitter share gplus share more share

I have WordPress e commerce site with responsive comparison theme , Now I have setup crawler which scrapes the price from various pages . This crawler gives me an api (url) which i want to post instead of numeric values. Now how do I program it to get the data from url and if the data from url is not available then to use another variable which would contain a fallback price. I want to use this api because the crawler runs every 15 minutes and could help me in getting live data. I would be importing these urls through csv import tool.

I modified class_core.php file to this:
Price Display
================================================== ======================== */
function curl_download($Url){
// is cURL installed yet?
if (!function_exists('curl_init')){
die('Sorry cURL is not installed!');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$url_for_value = "https://www.xyz.com/dddddd/ddddd";
// remember to add http colon and two slashes in front of url...
// stackoverflow tools won't let me do that here...
$val = curl_download($url_for_value);

function PRICE($val){

if(!is_numeric($val) && defined('WLT_JOBS') ){
// if not numeric, e.g. $100 , strip off non-numeric characters.
preg_match_all('/([\d]+)/', $val, $match);
// Do we have a valid number now?
if (!is_numeric($match[0]){
// perform other tests on return info from the CURL function?
return $val;
}
$val = $match[0];
}

but this code doesnt work
it gives me 500 internal error
In short can anyone tell how to post text from url in price function
anshulanilbansal is offline  
Closed Thread


Bookmarks

Tags
post, text, url, wordpress


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:21 AM.