hmm i'm looking into it.
and you are running php 5/
and have cURL installed?
Printable View
hmm i'm looking into it.
and you are running php 5/
and have cURL installed?
curl
cURL support enabled
cURL Information libcurl/7.19.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
PHP Version 5.2.10
Zen Cart 1.3.8a
ok lets try this;
Create a new file called: test.php
paste this code in it
enter your bit.ly username and api key inplace of the ones shown in red.Quote:
<?php
$url = "http://www.test.com";
$aParameters['login'] = 'username';
$aParameters['apiKey'] = 'R_f5003d838cfcc1498a0e43';
$aParameters['version'] = '2.0.1';
$queryString = '';
foreach($aParameters as $key => $value) $queryString .= '&'. $key .'='. urlencode(utf8_encode($value));
$queryString = trim($queryString, '&');
$url .= '?'. $queryString;
$url = 'http://api.bit.ly/'. $url;
$options[CURLOPT_URL] = $url;
$options[CURLOPT_PORT] = 80;
$options[CURLOPT_FOLLOWLOCATION] = true;
$options[CURLOPT_RETURNTRANSFER] = true;
$options[CURLOPT_TIMEOUT] = 60;
$curl = curl_init();
curl_setopt_array($curl, $options);
$response = curl_exec($curl);
$headers = curl_getinfo($curl);
$errorNumber = curl_errno($curl);
$errorMessage = curl_error($curl);
curl_close($curl);
print_r($headers);
?>
upload the file to your server.
run it from your browser.
if all goes well, it should spit out an array, showing us what your headers look like.
if not, you should get a similar error, either way let me know what you get.
Hi Jamie
Thanks for help , here is the result of http://pcitshop.com/test.php
Array ( [url] => http://api.bit.ly/http://www.test.com?login=my user name was here&apiKey=R_my key was here&version=2.0.1 [content_type] => text/html [http_code] => 403 [header_size] => 155 [request_size] => 139 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.131384 [namelookup_time] => 0.009571 [connect_time] => 0.069427 [pretransfer_time] => 0.069431 [size_upload] => 0 [size_download] => 169 [speed_download] => 1286 [speed_upload] => 0 [download_content_length] => 169 [upload_content_length] => -1 [starttransfer_time] => 0.131309 [redirect_time] => 0 )
regards
You're being blocked.
the [http_code] => 403 means that api.bit.ly is receiving your request but for whatever reason they're denying. I'm not sure why this is happening, they do black list sites but i already checked you're not blacklisted. It's possible that maybe you've reached some sort of limit, but you'd have to be a pretty heavy bit.ly user. more reason 403 errors occur: http://en.wikipedia.org/wiki/HTTP_403
try pasting this url into your browsers address bar:
(obviously change the username and apikey with your bit.ly info)PHP Code:
http://api.bit.ly/shorten?version=2.0.1&longUrl=http://bbc.com&login=username&apiKey=R_f5003d838cf6d2a0e4
you should get a string of text with an error code. if it works your error code should be 0 and you should see a shortened url for bbc.com if you get a different message it's probably your IP or your username
You could also try creating a new bitly account just to be safe and seeing if that works.
other than that you could disable the bitly portion of the script. however you run the chance of your tweets being over 140 chars. however you could just have something like "new product available "product name" @ http://pcitshop.com" posted to twitter.
I don't know why else you'd get that code. Sorry, it has to do with the headers being sent for json but that isn't really my area of expertise.
i got this result from above test you mentioned
{ "errorCode": 0, "errorMessage": "", "results": { "http://bbc.com": { "hash": "5KM2", "shortCNAMEUrl": "http://bit.ly/aET8Me", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/aET8Me", "userHash": "aET8Me" } }, "statusCode": "OK" }
plz let me know what to do next?
Regards
is json enabled? you can find out by typing:
phpinfo();
into a blank php file and scrolling down to json.
yes it is
json
json support enabled
json version 1.2.1
then i'm at a loss.
replace lines 128 through 148 of update_product.php with:
and see if it updates your twitter now. Basically this does the same thing without the link bit.ly shortening should be fine so long as your products name's arent too long.Quote:
// bof Auto Tweet.
include_once 'twitter/twitter.php';
// CHANGE: path to your store (i.e. http://example.com/store
$myStoreUrl = 'http://pcitshop.com';
// CHANGE: Your stores Twitter username and password
$twitter = new Twitter("username","password");
//build full link to product
$produrl = $myStoreUrl . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id ;
// send tweet.
$prodname = $sql_data_array['products_name'];
$mytweet = $prodname . ' now available at ' . $produrl;
$twitter->updateStatus($mytweet);
// eof Auto-Tweet
yes its working now , Thanks for help